cleaned up nordic config
This commit is contained in:
@@ -200,19 +200,18 @@ void systemsettings_build_ini(IniWriter *iw)
|
|||||||
iw_comment(iw, "nRF24L01+ radio");
|
iw_comment(iw, "nRF24L01+ radio");
|
||||||
iw_entry_s(iw, "com-nrf", str_yn(SystemSettings.use_comm_nordic));
|
iw_entry_s(iw, "com-nrf", str_yn(SystemSettings.use_comm_nordic));
|
||||||
|
|
||||||
iw_comment(iw, "nRF channel");
|
iw_comment(iw, "Radio channel (0-125)");
|
||||||
iw_entry_d(iw, "nrf-channel", SystemSettings.nrf_channel);
|
iw_entry_d(iw, "nrf-channel", SystemSettings.nrf_channel);
|
||||||
|
|
||||||
iw_comment(iw, "nRF network ID (hex, 4 bytes, little-endian)");
|
iw_comment(iw, "Network prefix (hex, 4 bytes)");
|
||||||
iw_entry(iw, "nrf-network", "%02X-%02X-%02X-%02X",
|
iw_entry(iw, "nrf-network", "%02X:%02X:%02X:%02X",
|
||||||
SystemSettings.nrf_network[0],
|
SystemSettings.nrf_network[0],
|
||||||
SystemSettings.nrf_network[1],
|
SystemSettings.nrf_network[1],
|
||||||
SystemSettings.nrf_network[2],
|
SystemSettings.nrf_network[2],
|
||||||
SystemSettings.nrf_network[3]);
|
SystemSettings.nrf_network[3]);
|
||||||
|
|
||||||
iw_comment(iw, "nRF node address (hex, 1 byte, > 0)");
|
iw_comment(iw, "Node address (1-255)");
|
||||||
iw_entry(iw, "nrf-address", "0x%02X",
|
iw_entry(iw, "nrf-address", "%d", (int)SystemSettings.nrf_address);
|
||||||
SystemSettings.nrf_address);
|
|
||||||
|
|
||||||
// those aren't implement yet, don't tease the user
|
// those aren't implement yet, don't tease the user
|
||||||
// TODO show pin-out, extra settings if applicable
|
// TODO show pin-out, extra settings if applicable
|
||||||
@@ -285,7 +284,7 @@ bool systemsettings_load_ini(const char *restrict key, const char *restrict valu
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (streq(key, "nrf-address")) {
|
if (streq(key, "nrf-address")) {
|
||||||
cfg_hex_parse(&SystemSettings.nrf_address, 1, value, &suc);
|
SystemSettings.nrf_address = cfg_u8_parse(value, &suc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (streq(key, "nrf-network")) {
|
if (streq(key, "nrf-network")) {
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ void cfg_hex_parse(uint8_t *dest, uint32_t count, const char *value, bool *suc)
|
|||||||
if (v != 0) value++;
|
if (v != 0) value++;
|
||||||
|
|
||||||
uint8_t nibble = 0;
|
uint8_t nibble = 0;
|
||||||
if (v == ' ' || v == '.' || v == '-' || v == ':') {
|
if (v == ' ' || v == '.' || v == ',' || v == '-' || v == ':') {
|
||||||
continue; // junk
|
continue; // junk
|
||||||
}
|
}
|
||||||
else if (v >= '0' && v <= '9') {
|
else if (v >= '0' && v <= '9') {
|
||||||
|
|||||||
Reference in New Issue
Block a user