|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
SETUP > SENSORS: up to four INA3221 parts on the sensor bus, at 0x40 to 0x43, and per channel its shunt and what it watches. More...
Go to the source code of this file.
Data Structures | |
| struct | settings_sensors_map_t |
Macros | |
| #define | SET_INA_FIT(a) |
The row ids: part a's FITTED, channel c's WATCHES, SHUNT and LIMIT. a is 0 to 3, c 0 to 11. | |
| #define | SET_INA_W(c) |
| #define | SET_INA_SH(c) |
| #define | SET_INA_LIM(c) |
Channel c's LIMIT row, 0 to 11. | |
Enumerations | |
| enum | { SENS_W_NONE = 0 , SENS_W_OUT_1 = 1 , SENS_W_PORT_1 = 9 , SENS_W_SUPPLY = 13 , SENS_W_COUNT = 14 } |
Functions | |
| const setting_def_t * | settings_sensors_def (setting_id_t id) |
| bool | settings_sensors_row (setting_id_t id) |
| int | settings_sensors_part (setting_id_t id) |
| uint16_t | settings_sensors_watch_code (int option) |
| int | settings_sensors_watch_option (uint16_t code) |
| The WATCHES option of a SENSE_MAP WATCH value. | |
| uint16_t | settings_sensors_limit_ma (int c) |
Channel c's LIMIT as SENSE_LIMIT's LIMIT_MA takes it. | |
| void | settings_sensors_unset (float *values) |
| int | settings_sensors_migrate (float *values) |
| void | settings_sensors_map (settings_sensors_map_t *m) |
| uint8_t | settings_sensors_fast (void) |
| uint8_t | settings_sensors_fitted (void) |
| uint16_t | settings_sensors_meter_dmohm (void) |
| The shunt of the channel the servo rail's meter reads. | |
| uint16_t | settings_sensors_dmohm (int c) |
| A channel's shunt as the map carries it. | |
SETUP > SENSORS: up to four INA3221 parts on the sensor bus, at 0x40 to 0x43, and per channel its shunt and what it watches.
Rows, in schema order: 0x40 FITTED to 0x43 FITTED, then per channel c – c = 3 a + ch - 1 for part a's channel ch, 0 to 11 – its WATCHES, its SHUNT and its LIMIT. A shunt of 0 switches the channel off; the next value up is 5.0mOhm (setting_def_t.off_below), and the top is 1000.0mOhm. What a channel watches is one of NONE, OUT 1 to OUT 8, PORT 1 to PORT 4 and SUPPLY: the output channels, the programming ports and the supply rail. LIMIT is the current a 50ms window's highest reading may reach before the band says so, 10 to 32767mA in 10mA steps on the arrows, 0 (OFF) for none: SENSE_LIMIT's LIMIT_MA (protocol 4.27), an alert only.
The map the rows make (settings_sensors_map()) is what the panel writes to the IOmcu's SENSE_MAP page (protocol 4.25), and the one INA3221 frame of SENSE (registers 8 to 10) it writes to an older IOmcu instead.
Migration. A build before SENSORS kept one INA3221 in four keys: ina3221_en, ina3221_adr, ina3221_mohm and ina3221_ch. They stay in the schema, in no category and on no screen, loaded and saved as stored, so a panel taken back to 0.21 finds its set-up. A SENSORS key the store does not hold is seeded from them at start-up, as a default is, until a save writes it (settings_sensors_migrate()):
A fresh panel holds no key, and the old keys' defaults (off, 0x40, 100.0mOhm, CH1) seed the schema's defaults: nothing fitted, every shunt 100.0mOhm, 0x40 CH1 watching OUT 1.
Pure C, as settings.c is.
SPDX-License-Identifier: MIT
| #define SET_INA_FIT | ( | a | ) |
The row ids: part a's FITTED, channel c's WATCHES, SHUNT and LIMIT. a is 0 to 3, c 0 to 11.
| #define SET_INA_LIM | ( | c | ) |
Channel c's LIMIT row, 0 to 11.
| #define SET_INA_SH | ( | c | ) |
| #define SET_INA_W | ( | c | ) |
| anonymous enum |
| const setting_def_t * settings_sensors_def | ( | setting_id_t | id | ) |
The schema row of id: a SENSORS row, or one of the four kept keys of 0.21; NULL for any other id.
| uint16_t settings_sensors_dmohm | ( | int | c | ) |
A channel's shunt as the map carries it.
| c | the channel |
| uint8_t settings_sensors_fast | ( | void | ) |
settings_sensors_map()'s FAST: the channel watching the servo tester's target, LINK_SM_FAST_NONE for none.
| uint8_t settings_sensors_fitted | ( | void | ) |
The fitted parts: bit a for 0x40 + a.
| uint16_t settings_sensors_limit_ma | ( | int | c | ) |
Channel c's LIMIT as SENSE_LIMIT's LIMIT_MA takes it.
| c | the channel, 0 to 11. |
c out of range. | void settings_sensors_map | ( | settings_sensors_map_t * | m | ) |
The map the values in force make, into m. FAST is the lowest channel with a shunt on a fitted part that watches the servo tester's target: an output, OUT 1 to OUT 8, while the target is OUTPUTS, and PORT n while it is programming port n (SET_SERVO_TARGET n).
| uint16_t settings_sensors_meter_dmohm | ( | void | ) |
The shunt of the channel the servo rail's meter reads.
| int settings_sensors_migrate | ( | float * | values | ) |
After the store is read and its values coerced: every SENSORS value still NAN seeded from the old INA3221 keys and the servo tester's target, as the file comment says. Returns how many were seeded.
| int settings_sensors_part | ( | setting_id_t | id | ) |
The part, 0 to 3, a SENSORS row belongs to; -1 for any other id.
| bool settings_sensors_row | ( | setting_id_t | id | ) |
Whether id is a SENSORS row.
| void settings_sensors_unset | ( | float * | values | ) |
Before the store is read: every SENSORS value set to NAN, a value no store holds, so settings_sensors_migrate() can tell a key the store did not have. values is the model's array of SETTING_COUNT.
| uint16_t settings_sensors_watch_code | ( | int | option | ) |
The SENSE_MAP WATCH value of WATCHES option option; NONE for one out of range.
| int settings_sensors_watch_option | ( | uint16_t | code | ) |
The WATCHES option of a SENSE_MAP WATCH value.
| code | a SENSE_MAP WATCH value. |