From 5f154cb20f26da8da4eb56f5b71cabfab50b7b95 Mon Sep 17 00:00:00 2001 From: Erick Ahmed Date: Wed, 14 May 2025 13:02:17 +0200 Subject: [PATCH] Refactor loop to main and add explicit while(true) This change transitions from the Arduino-specific `loop()` to a standard C++ `main()` function as the program's entry point and primary execution cycle. --- src/atmega/main.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/atmega/main.cpp b/src/atmega/main.cpp index 518d6de..dc9fd2f 100644 --- a/src/atmega/main.cpp +++ b/src/atmega/main.cpp @@ -31,14 +31,16 @@ void setup(void) { watchdogs(); } -void loop(void) { - if (readSensors) { - int16_t result = readMoisture(); - if (result != -1) { - Serial.println(result); - readSensors = false; +int main(void) { + while(true) { + if (readSensors) { + int16_t result = readMoisture(); + if (result != -1) { + Serial.println(result); + readSensors = false; + } } + enterSleep(); } - - enterSleep(); + return 0; }