Fix PD debug at boot
This commit is contained in:
@@ -70,14 +70,21 @@ OperatingMode guiHandleDraw(void) {
|
|||||||
break;
|
break;
|
||||||
case OperatingMode::UsbPDDebug:
|
case OperatingMode::UsbPDDebug:
|
||||||
#ifdef HAS_POWER_DEBUG_MENU
|
#ifdef HAS_POWER_DEBUG_MENU
|
||||||
showPDDebug(buttons, &context);
|
newMode = showPDDebug(buttons, &context);
|
||||||
break;
|
break;
|
||||||
#else
|
#else
|
||||||
/*fallthrough*/
|
newMode = OperatingMode::InitialisationDone;
|
||||||
#endif
|
#endif
|
||||||
case OperatingMode::StartupLogo:
|
case OperatingMode::StartupLogo:
|
||||||
BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); // TODO needs refactor
|
BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); // TODO needs refactor
|
||||||
newMode = OperatingMode::StartupWarnings;
|
if (getSettingValue(SettingsOptions::AutoStartMode) == 1) {
|
||||||
|
// jump directly to the autostart mode
|
||||||
|
newMode = OperatingMode::Sleeping;
|
||||||
|
} else if (getSettingValue(SettingsOptions::AutoStartMode) == 2) {
|
||||||
|
newMode = OperatingMode::Hibernating;
|
||||||
|
} else {
|
||||||
|
newMode = OperatingMode::HomeScreen;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Fallthrough */
|
/* Fallthrough */
|
||||||
@@ -161,6 +168,7 @@ OperatingMode handle_post_init_state() {
|
|||||||
#else
|
#else
|
||||||
if (buttonsAtDeviceBoot == BUTTON_F_LONG || buttonsAtDeviceBoot == BUTTON_F_SHORT) {
|
if (buttonsAtDeviceBoot == BUTTON_F_LONG || buttonsAtDeviceBoot == BUTTON_F_SHORT) {
|
||||||
#endif
|
#endif
|
||||||
|
buttonsAtDeviceBoot = BUTTON_NONE;
|
||||||
return OperatingMode::UsbPDDebug;
|
return OperatingMode::UsbPDDebug;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -169,15 +177,7 @@ OperatingMode handle_post_init_state() {
|
|||||||
return OperatingMode::CJCCalibration;
|
return OperatingMode::CJCCalibration;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getSettingValue(SettingsOptions::AutoStartMode) == 1) {
|
return OperatingMode::StartupLogo;
|
||||||
// jump directly to the autostart mode
|
|
||||||
return OperatingMode::Sleeping;
|
|
||||||
}
|
|
||||||
if (getSettingValue(SettingsOptions::AutoStartMode) == 2) {
|
|
||||||
return OperatingMode::Hibernating;
|
|
||||||
}
|
|
||||||
|
|
||||||
return OperatingMode::HomeScreen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* StartGUITask function */
|
/* StartGUITask function */
|
||||||
@@ -195,7 +195,6 @@ void startGUITask(void const *argument) {
|
|||||||
memset(&context, 0, sizeof(context));
|
memset(&context, 0, sizeof(context));
|
||||||
|
|
||||||
OLED::setRotation(getSettingValue(SettingsOptions::OrientationMode) & 1);
|
OLED::setRotation(getSettingValue(SettingsOptions::OrientationMode) & 1);
|
||||||
buttonsAtDeviceBoot = getButtonState();
|
|
||||||
|
|
||||||
// // If the boot logo is enabled with timeout and the autostart mode is enabled (but not set to sleep w/o heat), start heating during boot logo
|
// // If the boot logo is enabled with timeout and the autostart mode is enabled (but not set to sleep w/o heat), start heating during boot logo
|
||||||
// if (getSettingValue(SettingsOptions::LOGOTime) > 0 && getSettingValue(SettingsOptions::LOGOTime) < 5 && getSettingValue(SettingsOptions::AutoStartMode) > 0
|
// if (getSettingValue(SettingsOptions::LOGOTime) > 0 && getSettingValue(SettingsOptions::LOGOTime) < 5 && getSettingValue(SettingsOptions::AutoStartMode) > 0
|
||||||
@@ -209,7 +208,13 @@ void startGUITask(void const *argument) {
|
|||||||
// // Only heat to sleep temperature (but no higher than 75°C for safety)
|
// // Only heat to sleep temperature (but no higher than 75°C for safety)
|
||||||
// currentTempTargetDegC = min(sleepTempDegC, 75);
|
// currentTempTargetDegC = min(sleepTempDegC, 75);
|
||||||
// }
|
// }
|
||||||
// TODO
|
// Read boot button state
|
||||||
|
if (getButtonA()) {
|
||||||
|
buttonsAtDeviceBoot = BUTTON_F_LONG;
|
||||||
|
}
|
||||||
|
if (getButtonB()) {
|
||||||
|
buttonsAtDeviceBoot = BUTTON_B_LONG;
|
||||||
|
}
|
||||||
|
|
||||||
TickType_t startRender = xTaskGetTickCount();
|
TickType_t startRender = xTaskGetTickCount();
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ OperatingMode showPDDebug(const ButtonState buttons, guiContext *cxt) {
|
|||||||
}
|
}
|
||||||
// Skip not used entries
|
// Skip not used entries
|
||||||
if (voltage_mv == 0) {
|
if (voltage_mv == 0) {
|
||||||
*screen++;
|
(*screen) += 1;
|
||||||
} else {
|
} else {
|
||||||
// print out this entry of the proposal
|
// print out this entry of the proposal
|
||||||
OLED::printNumber(*screen, 2, FontStyle::SMALL, true); // print the entry number
|
OLED::printNumber(*screen, 2, FontStyle::SMALL, true); // print the entry number
|
||||||
@@ -72,17 +72,13 @@ OperatingMode showPDDebug(const ButtonState buttons, guiContext *cxt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*screen = 0;
|
(*screen) = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OLED::refresh();
|
|
||||||
if (buttons == BUTTON_B_SHORT)
|
if (buttons == BUTTON_B_SHORT)
|
||||||
return OperatingMode::InitialisationDone;
|
return OperatingMode::InitialisationDone;
|
||||||
else if (buttons == BUTTON_F_SHORT) {
|
else if (buttons == BUTTON_F_SHORT) {
|
||||||
*screen++;
|
(*screen) += 1;
|
||||||
}
|
|
||||||
|
|
||||||
GUIDelay();
|
|
||||||
}
|
}
|
||||||
return OperatingMode::UsbPDDebug;
|
return OperatingMode::UsbPDDebug;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user