mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
Default modbus serial param to N81
Optimized DUE flash saving routine
This commit is contained in:
@@ -1033,15 +1033,42 @@ int mqttConfigResp(char *as) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if defined(__SAM3X8E__)
|
||||
|
||||
#define saveBufLen 16000
|
||||
void cmdFunctionSave(int arg_cnt, char **args)
|
||||
{
|
||||
char* outBuf = (char*) malloc(saveBufLen); /* XXX: Dynamic size. */
|
||||
if (outBuf == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
debugSerial<<F("Saving config to EEPROM..");
|
||||
aJsonStringStream stringStream(NULL, outBuf, saveBufLen);
|
||||
aJson.print(root, &stringStream);
|
||||
int len = strlen(outBuf);
|
||||
outBuf[len++]= EOF;
|
||||
EEPROM.write(EEPROM_offset,(byte*) outBuf,len);
|
||||
|
||||
free (outBuf);
|
||||
debugSerial<<F("Saved to EEPROM");
|
||||
}
|
||||
|
||||
#else
|
||||
void cmdFunctionSave(int arg_cnt, char **args)
|
||||
{
|
||||
aJsonEEPROMStream jsonEEPROMStream = aJsonEEPROMStream(EEPROM_offset);
|
||||
debugSerial<<F("Saving config to EEPROM..");
|
||||
|
||||
aJson.print(root, &jsonEEPROMStream);
|
||||
jsonEEPROMStream.putEOF();
|
||||
|
||||
|
||||
debugSerial<<F("Saved to EEPROM");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void cmdFunctionIp(int arg_cnt, char **args)
|
||||
{
|
||||
IPAddress ip0(0, 0, 0, 0);
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef MODBUS_DIMMER_PARAM
|
||||
#define MODBUS_DIMMER_PARAM SERIAL_8E1
|
||||
#define MODBUS_DIMMER_PARAM SERIAL_8N1
|
||||
#endif
|
||||
|
||||
#define dimPar MODBUS_DIMMER_PARAM
|
||||
|
||||
Reference in New Issue
Block a user