From d980fdae1a88312d1b8f0341f8cd7f18b1a1f96b Mon Sep 17 00:00:00 2001 From: Magnus Persson Date: Wed, 27 Jul 2022 08:44:32 +0200 Subject: [PATCH] Adding sw ver to template engine --- src/templating.cpp | 3 +++ src/templating.hpp | 2 ++ src_docs/source/advanced.rst | 6 ++++++ src_docs/source/formula.rst | 23 +++++++++++++++++++++++ 4 files changed, 34 insertions(+) diff --git a/src/templating.cpp b/src/templating.cpp index 23b076f..89f0e43 100644 --- a/src/templating.cpp +++ b/src/templating.cpp @@ -130,6 +130,9 @@ void TemplatingEngine::initialize(float angle, float gravitySG, setVal(TPL_GRAVITY_CORR_P, convertToPlato(corrGravitySG), 1); setVal(TPL_GRAVITY_UNIT, myConfig.getGravityFormat()); + setVal(TPL_SW_VER, CFG_APPVER); + setVal(TPL_SW_REV, CFG_GITREV); + #if LOG_LEVEL == 6 // dumpAll(); #endif diff --git a/src/templating.hpp b/src/templating.hpp index 579c71e..5e01a9d 100644 --- a/src/templating.hpp +++ b/src/templating.hpp @@ -53,6 +53,8 @@ SOFTWARE. #define TPL_GRAVITY_CORR_G "${corr-gravity-sg}" #define TPL_GRAVITY_CORR_P "${corr-gravity-plato}" #define TPL_GRAVITY_UNIT "${gravity-unit}" // G or P +#define TPL_SW_VER "${sw-ver}" +#define TPL_SW_REV "${sw-rev}" #define TPL_FNAME_HTTP1 "/http-1.tpl" #define TPL_FNAME_HTTP2 "/http-2.tpl" diff --git a/src_docs/source/advanced.rst b/src_docs/source/advanced.rst index 33de863..817b7c8 100644 --- a/src_docs/source/advanced.rst +++ b/src_docs/source/advanced.rst @@ -99,4 +99,10 @@ These are the format keys available for use in the format. * - ${gravity-unit} - Gravity format, `G` or `P` - G + * - ${sw-ver} + - Software version + - 1.1.0 + * - ${sw-rev} + - Software revision (git hash) + - ..e456743 diff --git a/src_docs/source/formula.rst b/src_docs/source/formula.rst index 2094915..67384e2 100644 --- a/src_docs/source/formula.rst +++ b/src_docs/source/formula.rst @@ -9,8 +9,31 @@ Create formula Here you can enter up to 10 values (angles + gravity) that is then used to create the formula. Angles equal to zero will be regarded as empty even if there is a gravity reading. +When you submit the values the device will try create a forumla with increasing level of complexity. It will start +with a order 2 formula and then try 3 and 4. + +Once the formula has been created it will validate the formula against the supplied angles/gravity and if there is a too +high difference, it will fail. You can adjust the sensitivity under advanced settings if you have issues. + +Under the Error Log you will also find hints to what problem the formula creator encountered. Here is an example: + +`CALC: Validation failed on angle 33.430000, deviation too large 5.86, formula order 4` + +`CALC: Validation failed on angle 33.430000, deviation too large 3.14, formula order 2` + +This means that the angle 33.43 had a deviation of 5.8 SG and since the default threashold is 3, it will fail. You +can also see that it has failed on that point in both a order 2 and 4 formula. + +.. image:: images/qa_1.png + :width: 400 + :alt: Example of deviating value + +So in this case you can either increase the threashold or remove the angle that has an issue. You can also +use the graph on the calibration page to identify angles that is probably not correct. + .. image:: images/formula2.png :width: 800 :alt: Formula graph Once the formula is created a graph over the entered values and a simulation of the formula will give you a nice overview on how the formula will work. +