Further SD compatibility work with new comms

This commit is contained in:
Josh Stewart 2021-11-20 08:29:11 +11:00
parent a65beb46e0
commit 2439883a69
13 changed files with 133 additions and 335 deletions

View File

@ -1772,7 +1772,7 @@ menuDialog = main
menu = "Data Logging"
;subMenu = sdcard_datalog, "SD Card Datalogging"
;subMenu = std_ms3SdConsole, "Browse / Import SD Card", { boardHasRTC > 0 }
subMenu = std_ms3SdConsole, "Browse / Import SD Card", { boardHasRTC > 0 }
subMenu = rtc_settings, "Setup realtime clock"
subMenu = onboard_log_setup, "Setup onboard logger"

View File

@ -1,5 +1,5 @@
#ifndef SD_H
#define SD_H
#ifndef SD_LOGGER_H
#define SD_LOGGER_H
#ifdef SD_LOGGING
@ -16,6 +16,15 @@
#define SD_STATUS_ERROR_WRITE_FAIL 7 /**< Log file created and opened, but a sector write failed during logging */
#define SD_STATUS_ERROR_FORMAT_FAIL 8 /**< Attempted formatting of SD card failed */
#define SD_STATUS_CARD_PRESENT 0 //0=no card, 1=card present
#define SD_STATUS_CARD_TYPE 1 //0=SD, 1=SDHC
#define SD_STATUS_CARD_READY 2 //0=not ready, 1=ready
#define SD_STATUS_CARD_LOGGING 3 //0=not logging, 1=logging
#define SD_STATUS_CARD_ERROR 4 //0=no error, 1=error
#define SD_STATUS_CARD_VERSION 5 //0=1.x, 1=2.x
#define SD_STATUS_CARD_FS 6 //0=no FAT16, 1=FAT32
#define SD_SECTOR_SIZE 512 // Standard SD sector size
#ifdef CORE_TEENSY
@ -36,11 +45,11 @@ FsFile logFile;
RingBuf<FsFile, RING_BUF_CAPACITY> rb;
*/
//ExFat
SdExFat sd;
ExFile logFile;
RingBuf<ExFile, RING_BUF_CAPACITY> rb;
extern SdExFat sd;
extern ExFile logFile;
extern RingBuf<ExFile, RING_BUF_CAPACITY> rb;
uint8_t SD_status = SD_STATUS_OFF;
extern uint8_t SD_status;
void initSD();
void writeSDLogEntry();
@ -56,4 +65,4 @@ void dateTime(uint16_t*, uint16_t*, uint8_t*); //Used for timestamping with RTC
#endif //SD_LOGGING
#endif //SD_H
#endif //SD_LOGGER_H

View File

@ -5,6 +5,11 @@
#include "logger.h"
#include "rtc_common.h"
SdExFat sd;
ExFile logFile;
RingBuf<ExFile, RING_BUF_CAPACITY> rb;
uint8_t SD_status = SD_STATUS_OFF;
void initSD()
{
//Set default state to ready. If any stage of the init fails, this will be changed
@ -162,9 +167,22 @@ void setTS_SD_status()
indicator = { sd_status & 8}, "SD Log", "SD Log", white, black, green, black
indicator = { sd_status & 16}, "SD Err", "SD Err", white, black, red, black
*/
currentStatus.TS_SD_Status = SD_status;
//if(SD_status != SD_STATUS_ERROR_NO_CARD) { BIT_SET(currentStatus.TS_SD_Status, 0); } //Set bit for SD card being present
//if(SD_status == SD_STATUS_READY) { BIT_SET(currentStatus.TS_SD_Status, 2); } //Set bit for SD card being ready
//currentStatus.TS_SD_Status = SD_status;
if( SD_status == SD_STATUS_ERROR_NO_CARD ) { BIT_CLEAR(currentStatus.TS_SD_Status, SD_STATUS_CARD_PRESENT); } // CARD is not present
else { BIT_SET(currentStatus.TS_SD_Status, SD_STATUS_CARD_PRESENT); } // CARD present
BIT_SET(currentStatus.TS_SD_Status, SD_STATUS_CARD_TYPE); // CARD is SDHC
BIT_SET(currentStatus.TS_SD_Status, SD_STATUS_CARD_READY); // CARD is ready
if( SD_status == SD_STATUS_ACTIVE ) { BIT_SET(currentStatus.TS_SD_Status, SD_STATUS_CARD_LOGGING); }// CARD is logging
else { BIT_CLEAR(currentStatus.TS_SD_Status, SD_STATUS_CARD_LOGGING); }// CARD is not logging
if( (SD_status >= SD_STATUS_ERROR_NO_FS) ) { BIT_SET(currentStatus.TS_SD_Status, SD_STATUS_CARD_ERROR); }// CARD has an error
else { BIT_CLEAR(currentStatus.TS_SD_Status, SD_STATUS_CARD_ERROR); }// CARD has no error
BIT_SET(currentStatus.TS_SD_Status, SD_STATUS_CARD_FS); // CARD has a FAT32 filesystem (Though this will be exFAT)
}

View File

@ -13,6 +13,7 @@
#define PINMASK_TYPE uint8_t
#define COMPARE_TYPE uint16_t
#define COUNTER_TYPE uint16_t
#define SERIAL_BUFFER_SIZE 257 //Size of the serial buffer used by new comms protocol. Additional 1 byte is for flag
#ifdef USE_SPI_EEPROM
#define EEPROM_LIB_H "src/SPIAsEEPROM/SPIAsEEPROM.h"
typedef uint16_t eeprom_address_t;

View File

@ -16,6 +16,7 @@
#define PINMASK_TYPE uint8_t
#define COMPARE_TYPE uint16_t
#define COUNTER_TYPE uint16_t
#define SERIAL_BUFFER_SIZE 257 //Size of the serial buffer used by new comms protocol. Additional 1 byte is for flag
#ifdef USE_SPI_EEPROM
#define EEPROM_LIB_H "src/SPIAsEEPROM/SPIAsEEPROM.h"
typedef uint16_t eeprom_address_t;

View File

@ -10,6 +10,7 @@
#define PINMASK_TYPE uint32_t
#define COMPARE_TYPE uint16_t
#define COUNTER_TYPE uint16_t
#define SERIAL_BUFFER_SIZE 517 //Size of the serial buffer used by new comms protocol. For SD transfers this must be at least 512 + 1 (flag) + 4 (sector)
#define TIMER_RESOLUTION 2
#define micros_safe() micros() //timer5 method is not used on anything but AVR, the micros_safe() macro is simply an alias for the normal micros()
#if defined(SRAM_AS_EEPROM)

View File

@ -23,6 +23,7 @@
#define PINMASK_TYPE uint32_t
#define COMPARE_TYPE uint16_t
#define COUNTER_TYPE uint16_t
#define SERIAL_BUFFER_SIZE 517 //Size of the serial buffer used by new comms protocol. For SD transfers this must be at least 512 + 1 (flag) + 4 (sector)
#define micros_safe() micros() //timer5 method is not used on anything but AVR, the micros_safe() macro is simply an alias for the normal micros()
#define TIMER_RESOLUTION 4

View File

@ -15,6 +15,7 @@
#define PINMASK_TYPE uint8_t
#define COMPARE_TYPE uint16_t
#define COUNTER_TYPE uint16_t
#define SERIAL_BUFFER_SIZE 517 //Size of the serial buffer used by new comms protocol. For SD transfers this must be at least 512 + 1 (flag) + 4 (sector)
#define BOARD_MAX_DIGITAL_PINS 34
#define BOARD_MAX_IO_PINS 34 //digital pins + analog channels + 1
#ifdef USE_SPI_EEPROM

View File

@ -14,6 +14,7 @@
#define PINMASK_TYPE uint32_t
#define COMPARE_TYPE uint32_t
#define COUNTER_TYPE uint32_t
#define SERIAL_BUFFER_SIZE 517 //Size of the serial buffer used by new comms protocol. For SD transfers this must be at least 512 + 1 (flag) + 4 (sector)
#define BOARD_MAX_DIGITAL_PINS 34
#define BOARD_MAX_IO_PINS 34 //digital pins + analog channels + 1
#define EEPROM_LIB_H <EEPROM.h>

View File

@ -8,6 +8,7 @@
*/
#define PORT_TYPE uint32_t //Size of the port variables (Eg inj1_pin_port). Most systems use a byte, but SAMD21 and possibly others are a 32-bit unsigned int
#define PINMASK_TYPE uint32_t
#define SERIAL_BUFFER_SIZE 517 //Size of the serial buffer used by new comms protocol. For SD transfers this must be at least 512 + 1 (flag) + 4 (sector)
#define BOARD_MAX_IO_PINS 52 //digital pins + analog channels + 1
#define BOARD_MAX_DIGITAL_PINS 52 //Pretty sure this isn't right
#define EEPROM_LIB_H <EEPROM.h> //The name of the file that provides the EEPROM class

View File

@ -307,137 +307,9 @@ void command()
{
sendValues(offset, length, cmd, 0);
}
#ifdef RTC_ENABLED
else if(cmd == SD_RTC_PAGE) //Request to read SD card RTC
{
/*
uint16_t packetSize = 2 + 1 + length + 4;
packetSize = 15;
Serial.write(highByte(packetSize));
Serial.write(lowByte(packetSize));
byte packet[length+1];
packet[0] = 0;
packet[1] = length;
packet[2] = 0;
packet[3] = 0;
packet[4] = 0;
packet[5] = 0;
packet[6] = 0;
packet[7] = 0;
packet[8] = 0;
Serial.write(packet, 9);
FastCRC32 CRC32;
uint32_t CRC32_val = CRC32.crc32((byte *)packet, sizeof(packet) );;
//Split the 4 bytes of the CRC32 value into individual bytes and send
Serial.write( ((CRC32_val >> 24) & 255) );
Serial.write( ((CRC32_val >> 16) & 255) );
Serial.write( ((CRC32_val >> 8) & 255) );
Serial.write( (CRC32_val & 255) );
*/
Serial.write(rtc_getSecond()); //Seconds
Serial.write(rtc_getMinute()); //Minutes
Serial.write(rtc_getHour()); //Hours
Serial.write(rtc_getDOW()); //Day of Week
Serial.write(rtc_getDay()); //Date
Serial.write(rtc_getMonth()); //Month
Serial.write(lowByte(rtc_getYear())); //Year - NOTE 2 bytes
Serial.write(highByte(rtc_getYear())); //Year
}
else if(cmd == SD_READWRITE_PAGE) //Request SD card extended parameters
{
//SD read commands use the offset and length fields to indicate the request type
if((offset == SD_READ_STAT_OFFSET) && (length == SD_READ_STAT_LENGTH))
{
//Read the status of the SD card
//Serial.write(0);
//Serial.write(currentStatus.TS_SD_Status);
Serial.write((uint8_t)5);
Serial.write((uint8_t)0);
//All other values are 2 bytes
Serial.write((uint8_t)2); //Sector size
Serial.write((uint8_t)0); //Sector size
//Max blocks (4 bytes)
Serial.write((uint8_t)0);
Serial.write((uint8_t)0x20); //1gb dummy card
Serial.write((uint8_t)0);
Serial.write((uint8_t)0);
//Max roots (Number of files)
Serial.write((uint8_t)0);
Serial.write((uint8_t)1);
//Dir Start (4 bytes)
Serial.write((uint8_t)0); //Dir start lower 2 bytes
Serial.write((uint8_t)0); //Dir start lower 2 bytes
Serial.write((uint8_t)0); //Dir start lower 2 bytes
Serial.write((uint8_t)0); //Dir start lower 2 bytes
//Unkown purpose for last 2 bytes
Serial.write((uint8_t)0); //Dir start lower 2 bytes
Serial.write((uint8_t)0); //Dir start lower 2 bytes
/*
Serial.write(lowByte(23));
Serial.write(highByte(23));
byte packet[17];
packet[0] = 0;
packet[1] = 5;
packet[2] = 0;
packet[3] = 2;
packet[4] = 0;
packet[5] = 0;
packet[6] = 0x20;
packet[7] = 0;
packet[8] = 0;
packet[9] = 0;
packet[10] = 1;
packet[11] = 0;
packet[12] = 0;
packet[13] = 0;
packet[14] = 0;
packet[15] = 0;
packet[16] = 0;
Serial.write(packet, 17);
FastCRC32 CRC32;
uint32_t CRC32_val = CRC32.crc32((byte *)packet, sizeof(packet) );;
//Split the 4 bytes of the CRC32 value into individual bytes and send
Serial.write( ((CRC32_val >> 24) & 255) );
Serial.write( ((CRC32_val >> 16) & 255) );
Serial.write( ((CRC32_val >> 8) & 255) );
Serial.write( (CRC32_val & 255) );
*/
}
//else if(length == 0x202)
{
//File info
}
}
else if(cmd == 0x14)
{
//Fetch data from file
}
#endif
else
{
//No other r/ commands should be called
//No other r/ commands are supported in legacy mode
}
cmdPending = false;
}
@ -578,98 +450,21 @@ void command()
break;
case 'w':
//No w commands are supported in legacy mode. This should never be called
if(Serial.available() >= 7)
{
byte offset1, offset2, length1, length2;
{
byte offset1, offset2, length1, length2;
Serial.read(); // First byte of the page identifier can be ignored. It's always 0
currentPage = Serial.read();
//currentPage = 1;
offset1 = Serial.read();
offset2 = Serial.read();
valueOffset = word(offset2, offset1);
length1 = Serial.read();
length2 = Serial.read();
chunkSize = word(length2, length1);
}
#ifdef RTC_ENABLED
if(currentPage == SD_READWRITE_PAGE)
{
cmdPending = false;
//Reserved for the SD card settings. Appears to be hardcoded into TS. Flush the final byte in the buffer as its not used for now
Serial.read();
if((valueOffset == SD_WRITE_DO_OFFSET) && (chunkSize == SD_WRITE_DO_LENGTH))
{
/*
SD DO command. Single byte of data where the commands are:
0 Reset
1 Reset
2 Stop logging
3 Start logging
4 Load status variable
5 Init SD card
*/
Serial.read();
}
else if((valueOffset == SD_WRITE_SEC_OFFSET) && (chunkSize == SD_WRITE_SEC_LENGTH))
{
//SD write sector command
}
else if((valueOffset == SD_ERASEFILE_OFFSET) && (chunkSize == SD_ERASEFILE_LENGTH))
{
//Erase file command
//First 4 bytes are the log number in ASCII
/*
char log1 = Serial.read();
char log2 = Serial.read();
char log3 = Serial.read();
char log4 = Serial.read();
*/
//Next 2 bytes are the directory block no
Serial.read();
Serial.read();
}
else if((valueOffset == SD_SPD_TEST_OFFSET) && (chunkSize == SD_SPD_TEST_LENGTH))
{
//Perform a speed test on the SD card
//First 4 bytes are the sector number to write to
Serial.read();
Serial.read();
Serial.read();
Serial.read();
//Last 4 bytes are the number of sectors to test
Serial.read();
Serial.read();
Serial.read();
Serial.read();
}
}
else if(currentPage == SD_RTC_PAGE)
{
cmdPending = false;
//Used for setting RTC settings
if((valueOffset == SD_RTC_WRITE_OFFSET) && (chunkSize == SD_RTC_WRITE_LENGTH))
{
//Set the RTC date/time
//Need to ensure there are 9 more bytes with the new values
while(Serial.available() < 9) {} //Terrible hack, but RTC values should not be set with the engine running anyway
byte second = Serial.read();
byte minute = Serial.read();
byte hour = Serial.read();
//byte dow = Serial.read();
Serial.read(); // This is the day of week value, which is currently unused
byte day = Serial.read();
byte month = Serial.read();
uint16_t year = Serial.read();
year = word(Serial.read(), year);
Serial.read(); //Final byte is unused (Always has value 0x5a)
rtc_setTime(second, minute, hour, day, month, year);
}
}
#endif
Serial.read(); // First byte of the page identifier can be ignored. It's always 0
currentPage = Serial.read();
//currentPage = 1;
offset1 = Serial.read();
offset2 = Serial.read();
valueOffset = word(offset2, offset1);
length1 = Serial.read();
length2 = Serial.read();
chunkSize = word(length2, length1);
}
break;
case 'Z': //Totally non-standard testing function. Will be removed once calibration testing is completed. This function takes 1.5kb of program space! :S

View File

@ -23,12 +23,15 @@ A full copy of the license may be found in the projects root directory
#ifdef RTC_ENABLED
#include "rtc_common.h"
#endif
#ifdef SD_LOGGING
#include "SD_logger.h"
#endif
uint16_t serialPayloadLength = 0;
bool serialReceivePending = false; /**< Whether or not a serial request has only been partially received. This occurs when a the length has been received in the serial buffer, but not all of the payload or CRC has yet been received. */
uint16_t serialBytesReceived = 0;
uint32_t serialCRC = 0;
uint8_t serialPayload[257]; /**< Pointer to the serial payload buffer. */
uint8_t serialPayload[SERIAL_BUFFER_SIZE]; /**< Pointer to the serial payload buffer. */
/** Processes the incoming data on the serial buffer based on the command sent.
Can be either data for a new command or a continuation of data for command that is already in progress:
@ -373,14 +376,16 @@ void processSerialCommand()
#ifdef RTC_ENABLED
else if(cmd == SD_RTC_PAGE) //Request to read SD card RTC
{
Serial.write(rtc_getSecond()); //Seconds
Serial.write(rtc_getMinute()); //Minutes
Serial.write(rtc_getHour()); //Hours
Serial.write(rtc_getDOW()); //Day of Week
Serial.write(rtc_getDay()); //Date
Serial.write(rtc_getMonth()); //Month
Serial.write(lowByte(rtc_getYear())); //Year - NOTE 2 bytes
Serial.write(highByte(rtc_getYear())); //Year
serialPayload[0] = SERIAL_RC_OK;
serialPayload[1] = rtc_getSecond(); //Seconds
serialPayload[2] = rtc_getMinute(); //Minutes
serialPayload[3] = rtc_getHour(); //Hours
serialPayload[4] = rtc_getDOW(); //Day of week
serialPayload[5] = rtc_getDay(); //Day of month
serialPayload[6] = rtc_getMonth(); //Month
serialPayload[7] = highByte(rtc_getYear()); //Year
serialPayload[8] = lowByte(rtc_getYear()); //Year
sendSerialPayload(&serialPayload, 9);
}
else if(cmd == SD_READWRITE_PAGE) //Request SD card extended parameters
@ -390,74 +395,39 @@ void processSerialCommand()
{
//Read the status of the SD card
//Serial.write(0);
serialPayload[0] = SERIAL_RC_OK;
//Serial.write(currentStatus.TS_SD_Status);
Serial.write((uint8_t)5);
Serial.write((uint8_t)0);
serialPayload[1] = 5;
serialPayload[2] = 0;
//All other values are 2 bytes
Serial.write((uint8_t)2); //Sector size
Serial.write((uint8_t)0); //Sector size
//All other values are 2 bytes
//Sector size
serialPayload[3] = 2;
serialPayload[4] = 0;
//Max blocks (4 bytes)
Serial.write((uint8_t)0);
Serial.write((uint8_t)0x20); //1gb dummy card
Serial.write((uint8_t)0);
Serial.write((uint8_t)0);
serialPayload[5] = 0;
serialPayload[6] = 0x20; //1gb dummy card
serialPayload[7] = 0;
serialPayload[8] = 0;
//Max roots (Number of files)
Serial.write((uint8_t)0);
Serial.write((uint8_t)1);
serialPayload[9] = 0;
serialPayload[10] = 1;
//Dir Start (4 bytes)
Serial.write((uint8_t)0); //Dir start lower 2 bytes
Serial.write((uint8_t)0); //Dir start lower 2 bytes
Serial.write((uint8_t)0); //Dir start lower 2 bytes
Serial.write((uint8_t)0); //Dir start lower 2 bytes
serialPayload[11] = 0;
serialPayload[12] = 0;
serialPayload[13] = 0;
serialPayload[14] = 0;
//Unkown purpose for last 2 bytes
Serial.write((uint8_t)0); //Dir start lower 2 bytes
Serial.write((uint8_t)0); //Dir start lower 2 bytes
/*
Serial.write(lowByte(23));
Serial.write(highByte(23));
serialPayload[15] = 0;
serialPayload[16] = 0;
byte packet[17];
packet[0] = 0;
packet[1] = 5;
packet[2] = 0;
packet[3] = 2;
packet[4] = 0;
packet[5] = 0;
packet[6] = 0x20;
packet[7] = 0;
packet[8] = 0;
packet[9] = 0;
packet[10] = 1;
packet[11] = 0;
packet[12] = 0;
packet[13] = 0;
packet[14] = 0;
packet[15] = 0;
packet[16] = 0;
Serial.write(packet, 17);
uint32_t CRC32_val = CRC32.crc32((byte *)packet, sizeof(packet) );;
//Split the 4 bytes of the CRC32 value into individual bytes and send
Serial.write( ((CRC32_val >> 24) & 255) );
Serial.write( ((CRC32_val >> 16) & 255) );
Serial.write( ((CRC32_val >> 8) & 255) );
Serial.write( (CRC32_val & 255) );
*/
sendSerialPayload(&serialPayload, 17);
}
//else if(length == 0x202)
@ -577,27 +547,20 @@ void processSerialCommand()
}
case 'w':
if(Serial.available() >= 7)
{
byte offset1, offset2, length1, length2;
{
byte offset1, offset2, length1, length2;
uint8_t cmd = serialPayload[2];
offset1 = serialPayload[3];
offset2 = serialPayload[4];
uint16_t valueOffset = word(offset2, offset1);
length1 = serialPayload[5];
length2 = serialPayload[6];
uint16_t chunkSize = word(length2, length1);
Serial.read(); // First byte of the page identifier can be ignored. It's always 0
currentPage = Serial.read();
//currentPage = 1;
offset1 = Serial.read();
offset2 = Serial.read();
valueOffset = word(offset2, offset1);
length1 = Serial.read();
length2 = Serial.read();
chunkSize = word(length2, length1);
}
#ifdef RTC_ENABLED
if(currentPage == SD_READWRITE_PAGE)
if(cmd == SD_READWRITE_PAGE)
{
cmdPending = false;
//Reserved for the SD card settings. Appears to be hardcoded into TS. Flush the final byte in the buffer as its not used for now
Serial.read();
if((valueOffset == SD_WRITE_DO_OFFSET) && (chunkSize == SD_WRITE_DO_LENGTH))
{
/*
@ -609,7 +572,8 @@ void processSerialCommand()
4 Load status variable
5 Init SD card
*/
Serial.read();
setTS_SD_status(); //Set SD status values
sendSerialReturnCode(SERIAL_RC_OK);
}
else if((valueOffset == SD_WRITE_SEC_OFFSET) && (chunkSize == SD_WRITE_SEC_LENGTH))
{
@ -634,42 +598,47 @@ void processSerialCommand()
{
//Perform a speed test on the SD card
//First 4 bytes are the sector number to write to
Serial.read();
Serial.read();
Serial.read();
Serial.read();
uint32_t sector;
uint8_t sector1 = serialPayload[7];
uint8_t sector2 = serialPayload[8];
uint8_t sector3 = serialPayload[9];
uint8_t sector4 = serialPayload[10];
sector = (sector1 << 24) | (sector2 << 16) | (sector3 << 8) | sector4;
//Last 4 bytes are the number of sectors to test
Serial.read();
Serial.read();
Serial.read();
Serial.read();
uint32_t testSize;
uint8_t testSize1 = serialPayload[11];
uint8_t testSize2 = serialPayload[12];
uint8_t testSize3 = serialPayload[13];
uint8_t testSize4 = serialPayload[14];
testSize = (testSize1 << 24) | (testSize2 << 16) | (testSize3 << 8) | testSize4;
sendSerialReturnCode(SERIAL_RC_OK);
}
}
else if(currentPage == SD_RTC_PAGE)
else if(cmd == SD_RTC_PAGE)
{
cmdPending = false;
//Used for setting RTC settings
if((valueOffset == SD_RTC_WRITE_OFFSET) && (chunkSize == SD_RTC_WRITE_LENGTH))
{
//Set the RTC date/time
//Need to ensure there are 9 more bytes with the new values
while(Serial.available() < 9) {} //Terrible hack, but RTC values should not be set with the engine running anyway
byte second = Serial.read();
byte minute = Serial.read();
byte hour = Serial.read();
//byte dow = Serial.read();
Serial.read(); // This is the day of week value, which is currently unused
byte day = Serial.read();
byte month = Serial.read();
uint16_t year = Serial.read();
year = word(Serial.read(), year);
Serial.read(); //Final byte is unused (Always has value 0x5a)
byte second = serialPayload[7];
byte minute = serialPayload[8];
byte hour = serialPayload[9];
//byte dow = serialPayload[10]; //Not used
byte day = serialPayload[11];
byte month = serialPayload[12];
uint16_t year = word(serialPayload[14], serialPayload[13]);
rtc_setTime(second, minute, hour, day, month, year);
sendSerialReturnCode(SERIAL_RC_OK);
}
}
#endif
break;
}
default:
break;

View File

@ -51,7 +51,7 @@ extern uint16_t serialPayloadLength;
extern uint32_t serialCRC;
extern bool serialReceivePending; /**< Whether or not a serial request has only been partially received. This occurs when a the length has been received in the serial buffer, but not all of the payload or CRC has yet been received. */
//extern uint8_t *serialPayload; /**< Pointer to the serial payload buffer. */
extern uint8_t serialPayload[257]; /**< Pointer to the serial payload buffer. */
extern uint8_t serialPayload[SERIAL_BUFFER_SIZE]; /**< Pointer to the serial payload buffer. */
extern uint16_t serialBytesReceived; /**< The number of bytes received in the serial buffer during the current command. */
extern bool serialWriteInProgress;