Fix Teensy RTC setting bug

This commit is contained in:
Josh Stewart 2021-12-10 14:26:13 +11:00
parent f21a19595f
commit 93aa6f5fd5
3 changed files with 4 additions and 4 deletions

View File

@ -13,11 +13,11 @@
#ifndef UNIT_TEST // Scope guard for unit testing
#define LOG_ENTRY_SIZE 122 /**< The size of the live data packet. This MUST match ochBlockSize setting in the ini file */
#define SD_LOG_ENTRY_SIZE 122 /**< The size of the live data packet used by the SD car.*/
#define SD_LOG_ENTRY_SIZE 122 /**< The size of the live data packet used by the SD card.*/
#define SD_LOG_NUM_FIELDS 89 /**< The number of fields that are in the log. This is always smaller than the entry size due to some fields being 2 bytes */
#else
#define LOG_ENTRY_SIZE 1 /**< The size of the live data packet. This MUST match ochBlockSize setting in the ini file */
#define SD_LOG_ENTRY_SIZE 1 /**< The size of the live data packet used by the SD car.*/
#define SD_LOG_ENTRY_SIZE 1 /**< The size of the live data packet used by the SD card.*/
#endif
byte getTSLogEntry(uint16_t);

View File

@ -810,7 +810,7 @@ void processSerialCommand()
//byte dow = serialPayload[10]; //Not used
byte day = serialPayload[11];
byte month = serialPayload[12];
uint16_t year = word(serialPayload[14], serialPayload[13]);
uint16_t year = word(serialPayload[13], serialPayload[14]);
rtc_setTime(second, minute, hour, day, month, year);
sendSerialReturnCode(SERIAL_RC_OK);
}

View File

@ -111,7 +111,7 @@ void rtc_setTime(byte second, byte minute, byte hour, byte day, byte month, uint
{
#ifdef RTC_ENABLED
#if defined(CORE_TEENSY)
setTime(second, minute, hour, day, month, year);
setTime(hour, minute, second, day, month, year);
#elif defined(CORE_STM32)
rtc.setTime(hour, minute, second);
//year in stm32 rtc is a byte. so substract year 2000 to fit