add delay after wakeup of deep sleep; add command calibrate_scales
This commit is contained in:
parent
3a8764dcb4
commit
f0b4b0d286
|
|
@ -60,6 +60,7 @@ cCommandStream::CommandFn cmdGetScaleA;
|
|||
cCommandStream::CommandFn cmdGetScaleB;
|
||||
cCommandStream::CommandFn cmdCalibrateZeroScaleA;
|
||||
cCommandStream::CommandFn cmdCalibrateZeroScaleB;
|
||||
cCommandStream::CommandFn cmdCalibrateScales;
|
||||
cCommandStream::CommandFn cmdCalibrateScaleA;
|
||||
cCommandStream::CommandFn cmdCalibrateScaleB;
|
||||
cCommandStream::CommandFn cmdSetDebugLevel;
|
||||
|
|
@ -72,6 +73,7 @@ static const cCommandStream::cEntry sMyExtraCommmands[] =
|
|||
{ "hello", cmdHello },
|
||||
{ "get_calibration_settings", cmdGetCalibrationSettings },
|
||||
{ "get_sensor_readings", cmdGetSensorReadings },
|
||||
{ "calibrate_scales", cmdCalibrateScales },
|
||||
{ "calibrate_zero_scale_a", cmdCalibrateZeroScaleA },
|
||||
{ "calibrate_zero_scale_b", cmdCalibrateZeroScaleB },
|
||||
{ "calibrate_scale_a", cmdCalibrateScaleA },
|
||||
|
|
@ -970,6 +972,8 @@ void deepSleepRecovery(void)
|
|||
SPI.begin();
|
||||
if (fFlash)
|
||||
gSPI2.begin();
|
||||
// we wait 100 milliseconds after wakeup...
|
||||
delay(100);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1113,7 +1117,6 @@ cCommandStream::CommandStatus cmdHello(cCommandStream * pThis, void *pContext, i
|
|||
return cCommandStream::CommandStatus::kSuccess;
|
||||
}
|
||||
|
||||
|
||||
cCommandStream::CommandStatus cmdGetCalibrationSettings(cCommandStream * pThis, void *pContext, int argc, char **argv)
|
||||
{
|
||||
pThis->printf("{\n");
|
||||
|
|
@ -1178,6 +1181,25 @@ cCommandStream::CommandStatus cmdCalibrateZeroScaleB(cCommandStream * pThis, voi
|
|||
return cCommandStream::CommandStatus::kSuccess;
|
||||
}
|
||||
|
||||
cCommandStream::CommandStatus cmdCalibrateScales(cCommandStream * pThis, void *pContext, int argc, char **argv)
|
||||
{
|
||||
String s_cal_w1_0(argv[1]);
|
||||
String s_cal_w1_factor(argv[2]);
|
||||
String s_cal_w2_0(argv[3]);
|
||||
String s_cal_w2_factor(argv[4]);
|
||||
|
||||
config_data.cal_w1_0 = s_cal_w1_0.toInt();
|
||||
config_data.cal_w1_factor = s_cal_w1_factor.toFloat();
|
||||
config_data.cal_w2_0 = s_cal_w2_0.toInt();
|
||||
config_data.cal_w2_factor = s_cal_w2_factor.toFloat();
|
||||
|
||||
gCatena.getFram()->saveField(cFramStorage::kAppConf, (const uint8_t *)&config_data, sizeof(config_data));
|
||||
|
||||
pThis->printf("{ \"msg\": \"calibrate_scales was successful\" }\n");
|
||||
|
||||
return cCommandStream::CommandStatus::kSuccess;
|
||||
}
|
||||
|
||||
cCommandStream::CommandStatus cmdCalibrateScaleA(cCommandStream * pThis, void *pContext, int argc, char **argv)
|
||||
{
|
||||
String w1_gramm(argv[1]);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ enum {
|
|||
|
|
||||
\****************************************************************************/
|
||||
|
||||
static const int32_t fwVersion = 20200606;
|
||||
static const int32_t fwVersion = 20200608;
|
||||
|
||||
static const byte INIT_PACKAGE_INTERVAL = 100; // send an init package every 100 packages;
|
||||
static const byte MAX_VALUES_TO_SEND = 8;
|
||||
|
|
|
|||
Loading…
Reference in New Issue