Refactor webserver, changes to formulaCreation

This commit is contained in:
Magnus Persson
2022-01-04 19:46:37 +01:00
parent 0783a206b2
commit 5a7858ecaf
9 changed files with 284 additions and 220 deletions

View File

@ -30,7 +30,6 @@ SOFTWARE.
#define FORMULA_MAX_DEVIATION 1.5
//
// Use values to derive a formula
//
@ -61,6 +60,10 @@ int createFormula( RawFormulaData& fd, char *formulaBuffer, int order ) {
//Returned value is 0 if no error
if( ret == 0 ) {
#if LOG_LEVEL==6
Log.verbose(F("CALC: Finshied processing data points." CR));
#endif
// Print the formula based on 'order'
if( order == 4 ) {
sprintf( formulaBuffer, "%.8f*tilt^4+%.8f*tilt^3+%.8f*tilt^2+%.8f*tilt+%.8f", coeffs[0], coeffs[1], coeffs[2], coeffs[3], coeffs[4] );
@ -72,6 +75,10 @@ int createFormula( RawFormulaData& fd, char *formulaBuffer, int order ) {
sprintf( formulaBuffer, "%.8f*tilt+%.8f", coeffs[0], coeffs[1] );
}
#if LOG_LEVEL==6
Log.verbose(F("CALC: Formula: %s" CR), formulaBuffer );
#endif
bool valid = true;
for( int i = 0; i < 5; i++ ) {