From 91eea0ef0a3cb6d7fcee4e707db82fc19ee395ce Mon Sep 17 00:00:00 2001 From: Raymond Lutz Date: Fri, 15 Sep 2023 21:44:05 -0400 Subject: [PATCH] year zero = 2021 --- tictaccode_QTPY.ino | 5 +++-- tictaccode_XIAO.ino | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tictaccode_QTPY.ino b/tictaccode_QTPY.ino index 622e553..ff2c2a7 100644 --- a/tictaccode_QTPY.ino +++ b/tictaccode_QTPY.ino @@ -61,6 +61,7 @@ #define gps Serial1 #define console Serial #define VERSIONNUM 0 // two bits max +#define YEAR_ZERO 2021 // for encoding year with offset #define DAC_AMPLITUDE 511 #define DAC_MID_VALUE 511 // (2**10 - 1) / 2 #define LED_FLASH_DURATION 0.02 // sec @@ -73,7 +74,7 @@ 1 bit for clock source: bit=1 for GPS; bit=0 for RTC + 6 bits for secs + 6 bits for min + 5 bits for hr + 5 bits for day + 4 bit for month + - 5 bits for year offset (since 2021) = 35 + 5 bits for year offset (since YEAR_ZERO) = 35 */ @@ -235,7 +236,7 @@ void punchGPSintoWord() { copyBits2timecodeWord(HH, 16, 5); copyBits2timecodeWord(DD, 21, 5); copyBits2timecodeWord(MT, 26, 4); - copyBits2timecodeWord(YY - 2021, 30, 5); + copyBits2timecodeWord(YY - YEAR_ZERO, 30, 5); for (int i = 0; i <= N_SYMBOLS; i++) { if (i == 3 || i == 1 || i == 4 || i == 10 || i == 16 || i == 21 || i == 26 || i == 30) console.print(" "); diff --git a/tictaccode_XIAO.ino b/tictaccode_XIAO.ino index 4744784..700237e 100644 --- a/tictaccode_XIAO.ino +++ b/tictaccode_XIAO.ino @@ -55,6 +55,7 @@ https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex #define gps Serial1 #define console Serial #define VERSIONNUM 0 // two bits, so 3 max +#define YEAR_ZERO 2021 // for encoding year with offset #define DAC_AMPLITUDE 511 #define DAC_MID_VALUE 511 // (2**10 - 1) / 2 #define LED_FLASH_DURATION 0.02 // sec @@ -67,7 +68,7 @@ https://www.seeedstudio.com/Seeeduino-XIAO-Arduino-Microcontroller-SAMD21-Cortex 1 bit for clock source: bit=1 for GPS; bit=0 for RTC + 6 bits for secs + 6 bits for min + 5 bits for hr + 5 bits for day + 4 bit for month + - 5 bits for year offset (since 2021) = 35 + 5 bits for year offset (since YEAR_ZERO) = 35 */ @@ -226,7 +227,7 @@ void punchGPSintoWord() { copyBits2timecodeWord(HH, 16, 5); copyBits2timecodeWord(DD, 21, 5); copyBits2timecodeWord(MT, 26, 4); - copyBits2timecodeWord(YY - 2023, 30, 5); + copyBits2timecodeWord(YY - YEAR_ZERO, 30, 5); if (PRINT_OUTPUT) { for (int i = 0; i <= N_SYMBOLS; i++) { if (i == 3 || i == 1 || i == 4 || i == 10 || i == 16 || i == 21 || i == 26 || i == 30) -- 2.45.2