Adjusted error handling and formula deviation
This commit is contained in:
@ -99,10 +99,10 @@ int createFormula(RawFormulaData &fd, char *formulaBuffer,
|
|||||||
// If the deviation is more than 2 degress we mark it as failed.
|
// If the deviation is more than 2 degress we mark it as failed.
|
||||||
if (dev * 1000 > myAdvancedConfig.getMaxFormulaCreationDeviation()) {
|
if (dev * 1000 > myAdvancedConfig.getMaxFormulaCreationDeviation()) {
|
||||||
char s[120];
|
char s[120];
|
||||||
snprintf(
|
snprintf(&s[0], sizeof(s),
|
||||||
&s[0], sizeof(s),
|
"CALC: Validation failed on angle %f, deviation too large "
|
||||||
"CALC: Validation failed on angle %f, deviation too large %.8f, formula order %d",
|
"%.8f, formula order %d",
|
||||||
fd.a[i], dev, order);
|
fd.a[i], dev, order);
|
||||||
ErrorFileLog errLog;
|
ErrorFileLog errLog;
|
||||||
errLog.addEntry(&s[0]);
|
errLog.addEntry(&s[0]);
|
||||||
valid = false;
|
valid = false;
|
||||||
|
@ -54,10 +54,10 @@ struct RawFormulaData {
|
|||||||
|
|
||||||
class AdvancedConfig {
|
class AdvancedConfig {
|
||||||
private:
|
private:
|
||||||
int _wifiPortalTimeout = 120; // seconds
|
int _wifiPortalTimeout = 120; // seconds
|
||||||
int _wifiConnectTimeout = 20; // seconds
|
int _wifiConnectTimeout = 20; // seconds
|
||||||
float _maxFormulaCreationDeviation = 1.6; // SG
|
float _maxFormulaCreationDeviation = 3; // SG
|
||||||
float _defaultCalibrationTemp = 20.0; // C
|
float _defaultCalibrationTemp = 20.0; // C
|
||||||
int _gyroSensorMovingThreashold = 500;
|
int _gyroSensorMovingThreashold = 500;
|
||||||
int _tempSensorResolution = 9; // bits
|
int _tempSensorResolution = 9; // bits
|
||||||
int _gyroReadCount = 50;
|
int _gyroReadCount = 50;
|
||||||
|
@ -789,10 +789,13 @@ void WebServerHandler::webHandleFormulaRead() {
|
|||||||
doc[PARAM_ERROR] = "Internal error creating formula.";
|
doc[PARAM_ERROR] = "Internal error creating formula.";
|
||||||
break;
|
break;
|
||||||
case ERR_FORMULA_NOTENOUGHVALUES:
|
case ERR_FORMULA_NOTENOUGHVALUES:
|
||||||
doc[PARAM_ERROR] = "Not enough values to create formula.";
|
doc[PARAM_ERROR] =
|
||||||
|
"Not enough values to create formula, need at least 3 angles.";
|
||||||
break;
|
break;
|
||||||
case ERR_FORMULA_UNABLETOFFIND:
|
case ERR_FORMULA_UNABLETOFFIND:
|
||||||
doc[PARAM_ERROR] = "Unable to find an accurate formula based on input.";
|
doc[PARAM_ERROR] =
|
||||||
|
"Unable to find an accurate formula based on input, check error log "
|
||||||
|
"and graph below.";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
doc[PARAM_GRAVITY_FORMULA] = myConfig.getGravityFormula();
|
doc[PARAM_GRAVITY_FORMULA] = myConfig.getGravityFormula();
|
||||||
|
Reference in New Issue
Block a user