Skip to content

Commit

Permalink
Made resetreason methods static
Browse files Browse the repository at this point in the history
  • Loading branch information
tbnobody committed Nov 19, 2023
1 parent ee4811b commit 7538b43
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
8 changes: 3 additions & 5 deletions lib/ResetReason/src/ResetReason.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "rom/rtc.h"
#endif

String ResetReasonClass::get_reset_reason_verbose(uint8_t cpu_id)
String ResetReason::get_reset_reason_verbose(uint8_t cpu_id)
{
RESET_REASON reason;
reason = rtc_get_reset_reason(cpu_id);
Expand Down Expand Up @@ -86,7 +86,7 @@ String ResetReasonClass::get_reset_reason_verbose(uint8_t cpu_id)
return reason_str;
}

String ResetReasonClass::get_reset_reason_short(uint8_t cpu_id)
String ResetReason::get_reset_reason_short(uint8_t cpu_id)
{
RESET_REASON reason;
reason = rtc_get_reset_reason(cpu_id);
Expand Down Expand Up @@ -150,6 +150,4 @@ String ResetReasonClass::get_reset_reason_short(uint8_t cpu_id)
}

return reason_str;
}

ResetReasonClass ResetReason;
}
10 changes: 4 additions & 6 deletions lib/ResetReason/src/ResetReason.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@

#include <Arduino.h>

class ResetReasonClass {
class ResetReason {
public:
String get_reset_reason_verbose(uint8_t cpu_id);
String get_reset_reason_short(uint8_t cpu_id);
};

extern ResetReasonClass ResetReason;
static String get_reset_reason_verbose(uint8_t cpu_id);
static String get_reset_reason_short(uint8_t cpu_id);
};
4 changes: 2 additions & 2 deletions src/WebApi_sysstatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ void WebApiSysstatusClass::onSystemStatus(AsyncWebServerRequest* request)
root["chipcores"] = ESP.getChipCores();

String reason;
reason = ResetReason.get_reset_reason_verbose(0);
reason = ResetReason::get_reset_reason_verbose(0);
root["resetreason_0"] = reason;

reason = ResetReason.get_reset_reason_verbose(1);
reason = ResetReason::get_reset_reason_verbose(1);
root["resetreason_1"] = reason;

root["cfgsavecount"] = Configuration.get().Cfg.SaveCount;
Expand Down

0 comments on commit 7538b43

Please sign in to comment.