Browse Source

round af/rx-/txdelay to 3 decimal places

This avoids seeing 0.1999999 for direct.txdelay 0.2 :)
pull/2001/head
Wessel Nieboer 3 months ago
parent
commit
232c84cd14
No known key found for this signature in database GPG Key ID: 929C8E45E33B5FD2
  1. 8
      src/helpers/CommonCLI.cpp

8
src/helpers/CommonCLI.cpp

@ -773,7 +773,7 @@ void CommonCLI::handleGetCmd(uint32_t sender_timestamp, char* command, char* rep
int dc_frac = (int)((dc - dc_int) * 10.0f + 0.5f); int dc_frac = (int)((dc - dc_int) * 10.0f + 0.5f);
sprintf(reply, "> %d.%d%%", dc_int, dc_frac); sprintf(reply, "> %d.%d%%", dc_int, dc_frac);
} else if (memcmp(config, "af", 2) == 0) { } else if (memcmp(config, "af", 2) == 0) {
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->airtime_factor)); sprintf(reply, "> %s", StrHelper::ftoa3(_prefs->airtime_factor));
} else if (memcmp(config, "int.thresh", 10) == 0) { } else if (memcmp(config, "int.thresh", 10) == 0) {
sprintf(reply, "> %d", (uint32_t) _prefs->interference_threshold); sprintf(reply, "> %d", (uint32_t) _prefs->interference_threshold);
} else if (memcmp(config, "agc.reset.interval", 18) == 0) { } else if (memcmp(config, "agc.reset.interval", 18) == 0) {
@ -811,9 +811,9 @@ void CommonCLI::handleGetCmd(uint32_t sender_timestamp, char* command, char* rep
strcpy(bw, StrHelper::ftoa3(_prefs->bw)); strcpy(bw, StrHelper::ftoa3(_prefs->bw));
sprintf(reply, "> %s,%s,%d,%d", freq, bw, (uint32_t)_prefs->sf, (uint32_t)_prefs->cr); sprintf(reply, "> %s,%s,%d,%d", freq, bw, (uint32_t)_prefs->sf, (uint32_t)_prefs->cr);
} else if (memcmp(config, "rxdelay", 7) == 0) { } else if (memcmp(config, "rxdelay", 7) == 0) {
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->rx_delay_base)); sprintf(reply, "> %s", StrHelper::ftoa3(_prefs->rx_delay_base));
} else if (memcmp(config, "txdelay", 7) == 0) { } else if (memcmp(config, "txdelay", 7) == 0) {
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->tx_delay_factor)); sprintf(reply, "> %s", StrHelper::ftoa3(_prefs->tx_delay_factor));
} else if (memcmp(config, "flood.max.advert", 16) == 0) { } else if (memcmp(config, "flood.max.advert", 16) == 0) {
sprintf(reply, "> %d", (uint32_t)_prefs->flood_max_advert); sprintf(reply, "> %d", (uint32_t)_prefs->flood_max_advert);
} else if (memcmp(config, "flood.max.unscoped", 18) == 0) { } else if (memcmp(config, "flood.max.unscoped", 18) == 0) {
@ -821,7 +821,7 @@ void CommonCLI::handleGetCmd(uint32_t sender_timestamp, char* command, char* rep
} else if (memcmp(config, "flood.max", 9) == 0) { } else if (memcmp(config, "flood.max", 9) == 0) {
sprintf(reply, "> %d", (uint32_t)_prefs->flood_max); sprintf(reply, "> %d", (uint32_t)_prefs->flood_max);
} else if (memcmp(config, "direct.txdelay", 14) == 0) { } else if (memcmp(config, "direct.txdelay", 14) == 0) {
sprintf(reply, "> %s", StrHelper::ftoa(_prefs->direct_tx_delay_factor)); sprintf(reply, "> %s", StrHelper::ftoa3(_prefs->direct_tx_delay_factor));
} else if (memcmp(config, "owner.info", 10) == 0) { } else if (memcmp(config, "owner.info", 10) == 0) {
auto start = reply; auto start = reply;
*reply++ = '>'; *reply++ = '>';

Loading…
Cancel
Save