OpenSprinkler Forums OpenSprinkler Unified Firmware Create program with API

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #79250

    raphael
    Participant

    Hi,
    Hope someone will understand my question 🙂
    I’m trying to create programs through API.
    I’m following API documentation https://raysfiles.com/os_compiled_firmware/docs/2.2.0/OSAPI2.2.0(1).pdf
    I’m having trouble with the bit encoding, page 6, part 14 (14. Get Program Data [Keyword /jp])

    If I understand well the “flag” element contains binary values. But I can’t figure how to convert it.
    For example a program that is enabled, that dont use weather adjustment, no restrictions, use weekdays, no repetitions, no date range should be encoded at bit level as : “10000000” – if I understand the documentation.
    When I get my program data through API (opensprinklerIP/jp?pw=xxx) for such a program the flag is “1”.
    How a bit sequence “10000000” is converted to “1” ?
    When I use online converters, (https://www.rapidtables.com/convert/number/binary-to-octal.html) the binary 10000000 is converted to octal value 200, not 1.
    I’m stuck at that point.
    Thanks, have a good day !

    #79262

    DaveC
    Participant

    Hi Raphael,
    In bit fields, the Least Significant Bit (bit 0) is the right most bit. In your example: where the program is enabled and all other bits are zero, the field will look like: 00000001.
    Dave

    #79278

    raphael
    Participant

    Thanks a lot. I was thinking of bits like letters (left to right) but they are numbers (right to left). What a fool. Thanks a lot for your answer ! Have a good day.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums OpenSprinkler Unified Firmware Create program with API