Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use predefined "define" for reset reason #18462

Merged
merged 1 commit into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Marlin/src/HAL/STM32F1/HAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,8 @@ void HAL_clear_reset_source() { }

/**
* TODO: Check this and change or remove.
* currently returns 1 that's equal to poweron reset.
*/
uint8_t HAL_get_reset_source() { return 1; }
uint8_t HAL_get_reset_source() { return RST_POWER_ON; }

void _delay_ms(const int delay_ms) { delay(delay_ms); }

Expand Down
10 changes: 5 additions & 5 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -936,11 +936,11 @@ void setup() {

// Check startup - does nothing if bootloader sets MCUSR to 0
const byte mcu = HAL_get_reset_source();
if (mcu & 1) SERIAL_ECHOLNPGM(STR_POWERUP);
if (mcu & 2) SERIAL_ECHOLNPGM(STR_EXTERNAL_RESET);
if (mcu & 4) SERIAL_ECHOLNPGM(STR_BROWNOUT_RESET);
if (mcu & 8) SERIAL_ECHOLNPGM(STR_WATCHDOG_RESET);
if (mcu & 32) SERIAL_ECHOLNPGM(STR_SOFTWARE_RESET);
if (mcu & RST_POWER_ON) SERIAL_ECHOLNPGM(STR_POWERUP);
if (mcu & RST_EXTERNAL) SERIAL_ECHOLNPGM(STR_EXTERNAL_RESET);
if (mcu & RST_BROWN_OUT) SERIAL_ECHOLNPGM(STR_BROWNOUT_RESET);
if (mcu & RST_WATCHDOG) SERIAL_ECHOLNPGM(STR_WATCHDOG_RESET);
if (mcu & RST_SOFTWARE) SERIAL_ECHOLNPGM(STR_SOFTWARE_RESET);
HAL_clear_reset_source();

serialprintPGM(GET_TEXT(MSG_MARLIN));
Expand Down