Fix code attempting to sprintf %f (#14869)

Arduino doesn't (always) support `float` formatting in strings. So either cast to `int` or use `dtostrf()` to fix these usages.
This commit is contained in:
Scott Lahteine
2019-08-08 01:51:37 -05:00
committed by GitHub
parent 3e5620283e
commit c8e30b6639
8 changed files with 75 additions and 76 deletions

View File

@ -666,17 +666,14 @@ void ST7920_Lite_Status_Screen::draw_position(const float x, const float y, cons
// If position is unknown, flash the labels.
const unsigned char alt_label = position_known ? 0 : (ui.get_blink() ? ' ' : 0);
dtostrf(x, -4, 0, str);
write_byte(alt_label ? alt_label : 'X');
write_str(str, 4);
write_str(dtostrf(x, -4, 0, str), 4);
dtostrf(y, -4, 0, str);
write_byte(alt_label ? alt_label : 'Y');
write_str(str, 4);
write_str(dtostrf(y, -4, 0, str), 4);
dtostrf(z, -5, 1, str);
write_byte(alt_label ? alt_label : 'Z');
write_str(str, 5);
write_str(dtostrf(z, -5, 1, str), 5);
}
bool ST7920_Lite_Status_Screen::indicators_changed() {