From 933ebef400f0cd70b1a96fff7a9119129cbef2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=20K=C3=A9vin?= Date: Sat, 30 Jul 2016 15:24:40 +0200 Subject: [PATCH] add DCF command --- main.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/main.c b/main.c index e552c1d..5df0cec 100644 --- a/main.c +++ b/main.c @@ -335,10 +335,24 @@ static void process_command(char* str) // parse command if (0==strcmp(word,"help")) { printf("available commands:\n"); + printf("DCF77 on|off\n"); printf("time [HH:MM:SS]\n"); #if defined(EXTERNAL_RTC) && EXTERNAL_RTC printf("date [YYYY-MM-DD]\n"); #endif + } else if (0==strcmp(word,"DCF77")) { + word = strtok(NULL,delimiter); + if (!word) { + goto error; + } else if (0==strcmp(word,"on")) { + rtc_dcf77_on(); // switch DCF77 on + printf("DCF77 receiver switched on\n"); // notify user + } else if (0==strcmp(word,"off")) { + rtc_dcf77_off(); // switch DCF77 off + printf("DCF77 receiver switched off\n"); // notify user + } else { + goto error; + } } else if (0==strcmp(word,"time")) { word = strtok(NULL,delimiter); if (!word) { @@ -438,10 +452,15 @@ int main(void) rtc_interrupt_enable(RTC_SEC); // enable RTC interrupt on "seconds" nvic_enable_irq(NVIC_RTC_IRQ); // allow the RTC to interrupt #endif - rtc_dcf77_setup(); // setup DCF77 module - rtc_dcf77_on(); // switch on DCF77 module to get correct time printf("OK\n"); + // setup DCF77 + printf("setup DCF77 receiver: "); + rtc_dcf77_setup(); // setup DCF77 module + printf("OK\n"); + rtc_dcf77_on(); // switch DCF77 on to get correct time + printf("DCF77 receiver switched on\n"); // notify user + // setup WS2812B LEDs printf("setup LEDs: "); for (uint16_t i=0; i=ticks_midday*2) { // one day passed #if defined(EXTERNAL_RTC) && EXTERNAL_RTC