i don’t think anything has changed. if it’s always a u8 number for port, and then the rest of the values are expressed as s16, that simplifies things greatly. the expected signed-ness and type (integer, float, etc) and length (e.g. u8 for simple 0-or-1 values) was mostly what i was looking for. here are the types that crow uses, taken from the crow development readme:
- void – the lack of an argument (typically not needed)
- u8 – unsigned 8-bit integer (0,255)
- s8 – signed 8-bit integer (-128,127)
- u16 – unsigned 16-bit integer (0,65535)
- s16 – signed 16-bit integer (-32768, 32767) {teletype’s default}
- s16V – voltage as signed 16-bit integer (-32768, 32767) {converts teletype to V}
- float – 32bit floating point number
u16 s16 and s16V expect MSB before LSB. float is little-endian
this is some of the crow-301 .lua i wrote. the full file is here, and mixes a few different signs and types. docs strings are slightly modified from the wiki:
(lua code sample)
, { name = 'tr_time'
, cmd = 4
, get = true
, docs = 'Time for TR.PULSE *port* in *value* milliseconds'
, args = { { 'port', u8 }
, { 'value', u16 }
}
}
, { name = 'tr_pol'
, cmd = 5
, get = true
, docs = 'Polarity for TO.TR.PULSE *port* set to *value* (0/1)'
, args = { { 'port', u8 }
, { 'value', u8 }
}
}
, { name = 'cv'
, cmd = 6
, get = true
, docs = 'Set *port* CV to *value* (bipolar), following SLEW time'
, args = { { 'port', u8 }
, { 'value', s16 }
}
i took a quick look at the SC ops in the teletype source last night, but at the time i couldn’t entirely glean what actually is sent/received, and how it translates into the onscreen values within 301. if some are float, if a unit’s voltage 0-10V (for example) is internally expressed by a 16bit number, signed or otherwise. but based on your comment, i’m starting to think TT source lines 51, 63, and 68 indicate the types that TT works with.
given all the above, i may be able to simplify er301.lua further, without needing so many different data types.