Update and fix POWER_MONITOR (#18561)
This commit is contained in:
@ -28,6 +28,7 @@
|
||||
|
||||
#include "../lcd/ultralcd.h"
|
||||
#include "../lcd/lcdprint.h"
|
||||
#include "../libs/numtostr.h"
|
||||
|
||||
uint8_t PowerMonitor::flags; // = 0
|
||||
|
||||
@ -48,7 +49,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor
|
||||
#if ENABLED(POWER_MONITOR_CURRENT)
|
||||
void PowerMonitor::draw_current() {
|
||||
const float amps = getAmps();
|
||||
lcd_put_u8str(amps < 100 ? ftostr21ns(amps) : ui16tostr4((uint16_t)amps));
|
||||
lcd_put_u8str(amps < 100 ? ftostr31ns(amps) : ui16tostr4rj((uint16_t)amps));
|
||||
lcd_put_wchar('A');
|
||||
}
|
||||
#endif
|
||||
@ -56,7 +57,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor
|
||||
#if HAS_POWER_MONITOR_VREF
|
||||
void PowerMonitor::draw_voltage() {
|
||||
const float volts = getVolts();
|
||||
lcd_put_u8str(volts < 100 ? ftostr21ns(volts) : ui16tostr4((uint16_t)volts));
|
||||
lcd_put_u8str(volts < 100 ? ftostr31ns(volts) : ui16tostr4rj((uint16_t)volts));
|
||||
lcd_put_wchar('V');
|
||||
}
|
||||
#endif
|
||||
@ -64,7 +65,7 @@ PowerMonitor power_monitor; // Single instance - this calls the constructor
|
||||
#if HAS_POWER_MONITOR_WATTS
|
||||
void PowerMonitor::draw_power() {
|
||||
const float power = getPower();
|
||||
lcd_put_u8str(power < 100 ? ftostr21ns(power) : ui16tostr4((uint16_t)power));
|
||||
lcd_put_u8str(power < 100 ? ftostr31ns(power) : ui16tostr4rj((uint16_t)power));
|
||||
lcd_put_wchar('W');
|
||||
}
|
||||
#endif
|
||||
|
@ -100,13 +100,13 @@ public:
|
||||
static void draw_voltage();
|
||||
FORCE_INLINE static bool voltage_display_enabled() { return TEST(flags, PM_DISP_BIT_V); }
|
||||
FORCE_INLINE static void set_voltage_display(const bool b) { SET_BIT_TO(flags, PM_DISP_BIT_V, b); }
|
||||
FORCE_INLINE static void toggle_voltage_display() { TBI(flags, PM_DISP_BIT_I); }
|
||||
FORCE_INLINE static void toggle_voltage_display() { TBI(flags, PM_DISP_BIT_V); }
|
||||
#endif
|
||||
#if HAS_POWER_MONITOR_WATTS
|
||||
static void draw_power();
|
||||
FORCE_INLINE static bool power_display_enabled() { return TEST(flags, PM_DISP_BIT_P); }
|
||||
FORCE_INLINE static void set_power_display(const bool b) { SET_BIT_TO(flags, PM_DISP_BIT_P, b); }
|
||||
FORCE_INLINE static void toggle_power_display() { TBI(flags, PM_DISP_BIT_I); }
|
||||
FORCE_INLINE static void toggle_power_display() { TBI(flags, PM_DISP_BIT_P); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user