Fix and improve Power Monitor (#21551)

This commit is contained in:
gmarsh
2021-04-13 17:17:52 -03:00
committed by GitHub
parent 84c79d7531
commit a5f0075a60
8 changed files with 37 additions and 36 deletions

View File

@ -136,7 +136,7 @@
#if ENABLED(POWER_MONITOR_CURRENT)
const bool iflag = power_monitor.current_display_enabled();
#endif
#if HAS_POWER_MONITOR_VREF
#if ENABLED(POWER_MONITOR_VOLTAGE)
const bool vflag = power_monitor.voltage_display_enabled();
#endif
@ -148,7 +148,7 @@
}
#elif ENABLED(POWER_MONITOR_CURRENT)
power_monitor.display_item = 0;
#elif HAS_POWER_MONITOR_VREF
#elif ENABLED(POWER_MONITOR_VOLTAGE)
power_monitor.display_item = 1;
#endif
@ -157,7 +157,7 @@
#if ENABLED(POWER_MONITOR_CURRENT)
if (power_monitor.display_item == 0 && !iflag) ++power_monitor.display_item;
#endif
#if HAS_POWER_MONITOR_VREF
#if ENABLED(POWER_MONITOR_VOLTAGE)
if (power_monitor.display_item == 1 && !vflag) ++power_monitor.display_item;
#endif
#if HAS_POWER_MONITOR_WATTS
@ -170,7 +170,7 @@
#if ENABLED(POWER_MONITOR_CURRENT) // Current
case 0: if (iflag) power_monitor.draw_current(); break;
#endif
#if HAS_POWER_MONITOR_VREF // Voltage
#if ENABLED(POWER_MONITOR_VOLTAGE) // Voltage
case 1: if (vflag) power_monitor.draw_voltage(); break;
#endif
#if HAS_POWER_MONITOR_WATTS // Power

View File

@ -42,7 +42,7 @@ void menu_power_monitor() {
}
#endif
#if HAS_POWER_MONITOR_VREF
#if ENABLED(POWER_MONITOR_VOLTAGE)
{
bool ena = power_monitor.voltage_display_enabled();
EDIT_ITEM(bool, MSG_VOLTAGE, &ena, power_monitor.toggle_voltage_display);