From 5a3cb6cb4fe9aa2272be284bd729a831c1e31410 Mon Sep 17 00:00:00 2001 From: SeeedWenzy Date: Fri, 8 Dec 2023 15:50:06 +0800 Subject: [PATCH] 1.style:add comment --- .../Full_Almanac_Update.ino | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/examples/Full_Almanac_Update/Full_Almanac_Update.ino b/examples/Full_Almanac_Update/Full_Almanac_Update.ino index 44d489c..0c66fd7 100644 --- a/examples/Full_Almanac_Update/Full_Almanac_Update.ino +++ b/examples/Full_Almanac_Update/Full_Almanac_Update.ino @@ -1,6 +1,5 @@ #include -// #include #include #include #include @@ -11,9 +10,12 @@ 2.Note that the updated almanac in the almanac.h file are not necessarily newer than the almanac stored on the chip */ - +// Instance static LbmWm1110& lbmWm1110 = LbmWm1110::getInstance(); +uint32_t local_almanac_date = 0; // Local almanac date +uint32_t stored_almanac_date = 0; // Almanac date stored in WM1110 + // MyLbmxEventHandlers class MyLbmxEventHandlers : public LbmxEventHandlers { @@ -39,22 +41,31 @@ static void ModemEventHandler() handlers.invoke(event); } } -uint32_t local_almanac_date = 0; -uint32_t stored_almanac_date = 0; + void setup() { + // Initializes the debug output Serial.begin(115200); - while (!Serial) delay(100); + while (!Serial) delay(100); // Wait for ready printf("WM1110 Almanac Update Example\r\n"); + // Initialize WM1110 hardware peripherals lbmWm1110.begin(); + // Start runing LbmxEngine::begin(lbmWm1110.getRadio(), ModemEventHandler); + // Initialize almanac update + wm1110_almanac_update.begin(); + + // Update the almanac wm1110_almanac_update.updateStoredAlmanac(); + // Get Local almanac date local_almanac_date = wm1110_almanac_update.getFullAlmanacDateTime(); + + // Get almanac date stored in WM1110 after updated stored_almanac_date = wm1110_almanac_update.getStoredAlmanacDateTime(); } @@ -66,7 +77,7 @@ void loop() } else { - printf("Update WM1110 almanac success,almanac date:%u\r\n",local_almanac_date); + printf("Update WM1110 almanac success,almanac date:%lu\r\n",local_almanac_date); } delay(1000); }