Update and fix POWER_MONITOR (#18561)
This commit is contained in:
@ -113,22 +113,26 @@
|
||||
|
||||
lcd_moveto(x, y);
|
||||
|
||||
#if HAS_POWER_MONITOR_WATTS
|
||||
const bool wflag = power_monitor.power_display_enabled();
|
||||
#endif
|
||||
#if ENABLED(POWER_MONITOR_CURRENT)
|
||||
const bool iflag = power_monitor.current_display_enabled();
|
||||
#endif
|
||||
#if HAS_POWER_MONITOR_VREF
|
||||
const bool vflag = power_monitor.voltage_display_enabled();
|
||||
#endif
|
||||
#if HAS_POWER_MONITOR_WATTS
|
||||
const bool wflag = power_monitor.power_display_enabled();
|
||||
#endif
|
||||
|
||||
#if ENABLED(POWER_MONITOR_CURRENT) || HAS_POWER_MONITOR_VREF
|
||||
// cycle between current, voltage, and power
|
||||
#if HAS_POWER_MONITOR_WATTS
|
||||
// Cycle between current, voltage, and power
|
||||
if (ELAPSED(millis(), power_monitor.display_item_ms)) {
|
||||
power_monitor.display_item_ms = millis() + 1000UL;
|
||||
++power_monitor.display_item;
|
||||
}
|
||||
#elif ENABLED(POWER_MONITOR_CURRENT)
|
||||
power_monitor.display_item = 0;
|
||||
#elif HAS_POWER_MONITOR_VREF
|
||||
power_monitor.display_item = 1;
|
||||
#endif
|
||||
|
||||
// ensure we have the right one selected for display
|
||||
@ -139,7 +143,7 @@
|
||||
#if HAS_POWER_MONITOR_VREF
|
||||
if (power_monitor.display_item == 1 && !vflag) ++power_monitor.display_item;
|
||||
#endif
|
||||
#if ENABLED(POWER_MONITOR_CURRENT)
|
||||
#if HAS_POWER_MONITOR_WATTS
|
||||
if (power_monitor.display_item == 2 && !wflag) ++power_monitor.display_item;
|
||||
#endif
|
||||
if (power_monitor.display_item >= 3) power_monitor.display_item = 0;
|
||||
|
@ -33,26 +33,26 @@
|
||||
|
||||
void menu_power_monitor() {
|
||||
START_MENU();
|
||||
MENU_BACK(MSG_MAIN);
|
||||
BACK_ITEM(MSG_MAIN);
|
||||
|
||||
#if ENABLED(POWER_MONITOR_CURRENT)
|
||||
{
|
||||
bool ena = power_monitor.current_display_enabled();
|
||||
MENU_ITEM_EDIT_CALLBACK(bool, MSG_CURRENT, &ena, power_monitor.toggle_current_display);
|
||||
EDIT_ITEM(bool, MSG_CURRENT, &ena, power_monitor.toggle_current_display);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_POWER_MONITOR_VREF
|
||||
{
|
||||
bool ena = power_monitor.voltage_display_enabled();
|
||||
MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLTAGE, &ena, power_monitor.toggle_voltage_display);
|
||||
EDIT_ITEM(bool, MSG_VOLTAGE, &ena, power_monitor.toggle_voltage_display);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if HAS_POWER_MONITOR_WATTS
|
||||
{
|
||||
bool ena = power_monitor.power_display_enabled();
|
||||
MENU_ITEM_EDIT_CALLBACK(bool, MSG_POWER, &ena, power_monitor.toggle_power_display);
|
||||
EDIT_ITEM(bool, MSG_POWER, &ena, power_monitor.toggle_power_display);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user