Adjusted error handling and formula deviation

This commit is contained in:
Magnus Persson
2022-07-27 07:52:03 +02:00
parent 51e7ee6867
commit 8ee882c522
3 changed files with 13 additions and 10 deletions

View File

@ -99,9 +99,9 @@ int createFormula(RawFormulaData &fd, char *formulaBuffer,
// If the deviation is more than 2 degress we mark it as failed.
if (dev * 1000 > myAdvancedConfig.getMaxFormulaCreationDeviation()) {
char s[120];
snprintf(
&s[0], sizeof(s),
"CALC: Validation failed on angle %f, deviation too large %.8f, formula order %d",
snprintf(&s[0], sizeof(s),
"CALC: Validation failed on angle %f, deviation too large "
"%.8f, formula order %d",
fd.a[i], dev, order);
ErrorFileLog errLog;
errLog.addEntry(&s[0]);

View File

@ -56,7 +56,7 @@ class AdvancedConfig {
private:
int _wifiPortalTimeout = 120; // seconds
int _wifiConnectTimeout = 20; // seconds
float _maxFormulaCreationDeviation = 1.6; // SG
float _maxFormulaCreationDeviation = 3; // SG
float _defaultCalibrationTemp = 20.0; // C
int _gyroSensorMovingThreashold = 500;
int _tempSensorResolution = 9; // bits

View File

@ -789,10 +789,13 @@ void WebServerHandler::webHandleFormulaRead() {
doc[PARAM_ERROR] = "Internal error creating formula.";
break;
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;
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;
default:
doc[PARAM_GRAVITY_FORMULA] = myConfig.getGravityFormula();