Removing While Loop and int fixes

This commit is contained in:
unlogisch04
2026-01-11 15:54:45 +01:00
parent bd87ff8bdb
commit d279b97543
2 changed files with 8 additions and 18 deletions

View File

@@ -23,19 +23,17 @@
#include <Arduino.h>
#ifdef ESP8266
#include <user_interface.h> // Include this to define rst_info
#include <user_interface.h> // Include this to define rst_info
typedef struct rtc_mem {
uint32_t version; // RTC memory version
uint32_t version; // RTC memory version
uint32_t rebootCount; // Number of reboots
} rtc_mem_t;
// Constructor function that runs during static initialization (before setup)
__attribute__((constructor))
void checkrebootcount(){
__attribute__((constructor)) void checkrebootcount() {
Serial.begin(115200);
struct rst_info *resetreason;
struct rst_info* resetreason;
rtc_mem_t rtcMem;
resetreason = ESP.getResetInfoPtr();
Serial.println("Reset reason code: " + String(resetreason->reason));
@@ -48,9 +46,9 @@ void checkrebootcount(){
rtcMem.version = 0x01;
rtcMem.rebootCount = 0;
}
if (resetreason->reason != REASON_SOFT_WDT_RST &&
resetreason->reason != REASON_EXCEPTION_RST &&
resetreason->reason != REASON_WDT_RST) {
if (resetreason->reason != REASON_SOFT_WDT_RST
&& resetreason->reason != REASON_EXCEPTION_RST
&& resetreason->reason != REASON_WDT_RST) {
// Not a crash, reset reboot counter
rtcMem.rebootCount = 0;
} else {
@@ -75,8 +73,6 @@ void checkrebootcount(){
}
Serial.println("Reboot Count: " + String(rtcMem.rebootCount));
ESP.rtcUserMemoryWrite(33, (uint32_t*)&rtcMem, sizeof(struct rtc_mem));
}
#endif

View File

@@ -26,6 +26,7 @@
#endif
#include <i2cscan.h>
#include "GlobalVars.h"
#include "Wire.h"
#include "batterymonitor.h"
@@ -62,10 +63,6 @@ BatteryMonitor battery;
TPSCounter tpsCounter;
void setup() {
while (true) {
}
Serial.begin(serialBaudRate);
globalTimer = timer_create_default();
@@ -166,9 +163,6 @@ void loop() {
OTA::otaUpdate();
networkManager.update();
// Process buffered logs
SlimeVR::Logging::LogBuffer::getInstance().processCycle();
#if DEBUG_MEASURE_SENSOR_TIME_TAKEN
sensorMeasurer.before();
#endif