clangtidy corrections part 1
This commit is contained in:
+739
@@ -0,0 +1,739 @@
|
|||||||
|
|
||||||
|
lib/MQTT/debugMqtt.cpp:22: [medium:warning] 'name' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/MQTT/debugMqtt.cpp:23: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/MQTT/debugMqtt.cpp:32: [medium:warning] 2 adjacent parameters of 'sendMsg' of similar type ('String') are easily swapped by mistake [bugprone-easily-swappable-parameters]
|
||||||
|
lib/MQTT/debugMqtt.cpp:32: [medium:warning] the parameter 'msg' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
|
||||||
|
lib/MQTT/debugMqtt.cpp:33: [medium:warning] the value returned by this function should be used [cert-err33-c]
|
||||||
|
lib/MQTT/debugMqtt.cpp:33: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/MQTT/debugMqtt.cpp:34: [medium:warning] parameter 'topic' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
|
||||||
|
lib/MQTT/debugMqtt.cpp:34: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/MQTT/debugMqtt.cpp:38: [medium:warning] parameter 'msg' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
|
||||||
|
lib/MQTT/debugMqtt.cpp:41: [medium:warning] method 'sendData' can be made static [readability-convert-member-functions-to-static]
|
||||||
|
lib/MQTT/debugMqtt.cpp:41: [medium:warning] the parameter 'topic' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
|
||||||
|
lib/MQTT/debugMqtt.cpp:41: [medium:warning] the parameter 'data' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
|
||||||
|
lib/MQTT/debugMqtt.cpp:47: [medium:warning] the value returned by this function should be used [cert-err33-c]
|
||||||
|
lib/MQTT/debugMqtt.cpp:47: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/MQTT/debugMqtt.cpp:48: [medium:warning] the value returned by this function should be used [cert-err33-c]
|
||||||
|
lib/MQTT/debugMqtt.cpp:48: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/MQTT/debugMqtt.cpp:49: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/MQTT/debugMqtt.cpp:49: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/MQTT/debugMqtt.cpp:54: [medium:warning] parameter 'data' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
|
||||||
|
lib/MQTT/debugMqtt.cpp:57: [medium:warning] the parameter 'measurement_name' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
|
||||||
|
lib/MQTT/debugMqtt.cpp:57: [medium:warning] the parameter 'field_set' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
|
||||||
|
lib/MQTT/debugMqtt.cpp:60: [medium:warning] the value returned by this function should be used [cert-err33-c]
|
||||||
|
lib/MQTT/debugMqtt.cpp:60: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/MQTT/debugMqtt.cpp:61: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/MQTT/debugMqtt.cpp:64: [medium:warning] parameter name 'c' is too short, expected at least 3 characters [readability-identifier-length]
|
||||||
|
lib/Menu/src/menu.cpp:13: [medium:warning] constructor does not initialize these fields: entrys, selectedEntry [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/Menu/src/menu.cpp:18: [medium:warning] variable 'iter' is not initialized [cppcoreguidelines-init-variables]
|
||||||
|
lib/Menu/src/menu.cpp:18: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menu.cpp:25: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menu.cpp:29: [medium:warning] method 'isInSubmenu' can be made const [readability-make-member-function-const]
|
||||||
|
lib/Menu/src/menu.cpp:34: [medium:warning] variable 'iter' is not initialized [cppcoreguidelines-init-variables]
|
||||||
|
lib/Menu/src/menu.cpp:43: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menu.cpp:63: [medium:warning] missing username/bug in TODO [google-readability-todo]
|
||||||
|
lib/Menu/src/menu.cpp:64: [medium:warning] variable 'iter' is not initialized [cppcoreguidelines-init-variables]
|
||||||
|
lib/Menu/src/menu.cpp:66: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menu.cpp:68: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menu.cpp:78: [medium:warning] variable 'iter' is not initialized [cppcoreguidelines-init-variables]
|
||||||
|
lib/Menu/src/menu.cpp:108: [medium:warning] implicit conversion 'MenuControl *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Menu/src/menu.cpp:108: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuAction.cpp:13: [medium:warning] 2 adjacent parameters of 'MenuAction' of similar type ('void (*)()') are easily swapped by mistake [bugprone-easily-swappable-parameters]
|
||||||
|
lib/Menu/src/menuAction.cpp:14: [medium:warning] 'name' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuAction.cpp:15: [medium:warning] 'function' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuAction.cpp:16: [medium:warning] 'callback' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuAction.cpp:20: [medium:warning] 'name' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuAction.cpp:21: [medium:warning] 'menu' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuAction.cpp:22: [medium:warning] 'isMenu' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuAction.cpp:26: [medium:warning] 'name' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuAction.cpp:27: [medium:warning] 'action' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuAction.cpp:31: [medium:warning] 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
|
||||||
|
lib/Menu/src/menuAction.cpp:31: [medium:warning] implicit conversion 'MenuControl *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Menu/src/menuAction.cpp:31: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuAction.cpp:34: [medium:warning] 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
|
||||||
|
lib/Menu/src/menuAction.cpp:34: [medium:warning] implicit conversion 'MenuActionWrapper *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Menu/src/menuAction.cpp:34: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuAction.cpp:39: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuAction.cpp:42: [medium:warning] implicit conversion 'void (*)()' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Menu/src/menuAction.cpp:42: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuAction.cpp:44: [medium:warning] implicit conversion 'MenuActionWrapper *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Menu/src/menuAction.cpp:44: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuAction.cpp:46: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuAction.cpp:50: [medium:warning] implicit conversion 'void (*)()' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Menu/src/menuAction.cpp:50: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuAction.cpp:58: [medium:warning] method 'getIsMenu' can be made const [readability-make-member-function-const]
|
||||||
|
lib/Menu/src/menuAction.cpp:63: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuAction.cpp:65: [medium:warning] do not use 'else' after 'return' [readability-else-after-return]
|
||||||
|
lib/Menu/src/menuAction.cpp:65: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuControl.cpp:14: [medium:warning] the parameter 'lineOne' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
|
||||||
|
lib/Menu/src/menuControl.cpp:14: [medium:warning] the parameter 'lineTwo' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
|
||||||
|
lib/Menu/src/menuControl.cpp:15: [medium:warning] implicit conversion 'DisplayWrapper *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Menu/src/menuControl.cpp:27: [medium:warning] implicit conversion 'DisplayWrapper *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Menu/src/menuControl.cpp:27: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuInformationSites.cpp:15: [medium:warning] 'countPages' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuInformationSites.cpp:16: [medium:warning] 'currentPage' should be initialized in an in-class default member initializer [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuInformationSites.cpp:17: [medium:warning] 'lastMillis' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuInformationSites.cpp:21: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuInformationSites.cpp:23: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuInformationSites.cpp:29: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuInformationSites.cpp:31: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuInformationSites.cpp:41: [medium:warning] implicit conversion 'MenuControl *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Menu/src/menuInformationSites.cpp:92: [medium:warning] variable 'lineOne' of type 'String' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Menu/src/menuInformationSites.cpp:93: [medium:warning] variable 'lineTwo' of type 'String' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:15: [medium:warning] 'values' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:16: [medium:warning] 'names' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:17: [medium:warning] 'length' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:18: [medium:warning] 'wrapper' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:20: [medium:warning] 'min' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:21: [medium:warning] 'max' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:22: [medium:warning] 'originalValues' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:23: [medium:warning] 'stepsPerInput' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:34: [medium:warning] 'length' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:35: [medium:warning] 'wrapper' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:37: [medium:warning] 'values' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:38: [medium:warning] 'names' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:38: [medium:warning] do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:38: [medium:warning] C-style casts are discouraged; use reinterpret_cast [google-readability-casting]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:39: [medium:warning] 'min' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:40: [medium:warning] 'max' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:41: [medium:warning] 'originalValues' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:42: [medium:warning] 'stepsPerInput' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:50: [medium:warning] result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ptrdiff_t' [bugprone-implicit-widening-of-multiplication-result]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:65: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:68: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:72: [medium:warning] result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ptrdiff_t' [bugprone-implicit-widening-of-multiplication-result]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:78: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:85: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:91: [medium:warning] 2 adjacent parameters of 'setMinMax' of similar type ('int16_t') are easily swapped by mistake [bugprone-easily-swappable-parameters]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:97: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:102: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:106: [medium:warning] 2 adjacent parameters of 'setMinMax' of similar type ('int16_t') are easily swapped by mistake [bugprone-easily-swappable-parameters]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:111: [medium:warning] 3 adjacent parameters of 'setMinMaxSteps' of convertible types are easily swapped by mistake [bugprone-easily-swappable-parameters]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:117: [medium:warning] 3 adjacent parameters of 'setMinMaxSteps' of convertible types are easily swapped by mistake [bugprone-easily-swappable-parameters]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:124: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:131: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:162: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:164: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:171: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:173: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:180: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:184: [medium:warning] implicit conversion 'MenuControl *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:192: [medium:warning] implicit conversion 'MenuControl *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:199: [medium:warning] 17 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:203: [medium:warning] the value returned by this function should be used [cert-err33-c]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:203: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:203: [medium:warning] result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ptrdiff_t' [bugprone-implicit-widening-of-multiplication-result]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:206: [medium:warning] the value returned by this function should be used [cert-err33-c]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:206: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:206: [medium:warning] result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ptrdiff_t' [bugprone-implicit-widening-of-multiplication-result]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:209: [medium:warning] the value returned by this function should be used [cert-err33-c]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:209: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:209: [medium:warning] result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ptrdiff_t' [bugprone-implicit-widening-of-multiplication-result]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:212: [medium:warning] the value returned by this function should be used [cert-err33-c]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:212: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:212: [medium:warning] result of multiplication in type 'int' is used as a pointer offset after an implicit widening conversion to type 'ptrdiff_t' [bugprone-implicit-widening-of-multiplication-result]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:215: [medium:warning] 17 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:216: [medium:warning] implicit conversion 'int16_t' (aka 'short') -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:216: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:217: [medium:warning] the value returned by this function should be used [cert-err33-c]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:217: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:218: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:219: [medium:warning] the value returned by this function should be used [cert-err33-c]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:219: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:221: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Menu/src/menuIntInput.cpp:221: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/MotorControl/motorControl.cpp:15: [medium:warning] constructor does not initialize these fields: pwmPin, pwmChannel, dutycycleMin, dutycycleMax, dir_1, dir_2 [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/MotorControl/motorControl.cpp:21: [medium:warning] 3 adjacent parameters of 'init' of similar type ('uint8_t') are easily swapped by mistake [bugprone-easily-swappable-parameters]
|
||||||
|
lib/MotorControl/motorControl.cpp:40: [medium:warning] variable 'abs_difference' of type 'uint8_t' (aka 'unsigned char') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/MotorControl/motorControl.cpp:43: [medium:warning] variable 'difference' of type 'int16_t' (aka 'short') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/MotorControl/motorControl.cpp:84: [medium:warning] 80 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/MotorControl/motorControl.cpp:84: [medium:warning] statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/MotorControl/motorControl.cpp:84: [medium:warning] 80 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/MotorControl/motorControl.cpp:86: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
lib/MotorControl/motorControl.cpp:86: [medium:warning] use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
|
||||||
|
lib/MotorControl/motorControl.cpp:91: [medium:warning] 100 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/MotorControl/motorControl.cpp:91: [medium:warning] statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/MotorControl/motorControl.cpp:91: [medium:warning] 100 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/MotorControl/motorControl.cpp:93: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
lib/MotorControl/motorControl.cpp:93: [medium:warning] use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
|
||||||
|
lib/MotorControl/motorControl.cpp:98: [medium:warning] 100 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/MotorControl/motorControl.cpp:98: [medium:warning] 100 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/MotorControl/motorControl.cpp:98: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/MotorControl/motorControl.cpp:100: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/MotorControl/motorControl.cpp:113: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/MotorControl/motorControl.cpp:114: [medium:warning] redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
|
||||||
|
lib/MotorControl/motorControl.cpp:119: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/MotorControl/motorControl.cpp:120: [medium:warning] redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
|
||||||
|
lib/MotorControl/motorControl.cpp:125: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/MotorControl/motorControl.cpp:126: [medium:warning] redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
|
||||||
|
lib/MotorControl/motorControl.cpp:131: [medium:warning] missing username/bug in TODO [google-readability-todo]
|
||||||
|
lib/MotorControl/motorControl.cpp:132: [medium:warning] 100 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/MotorControl/motorControl.cpp:132: [medium:warning] 100 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/MotorControl/motorControl.cpp:147: [medium:warning] variable 'pwm_val' of type 'uint8_t' (aka 'unsigned char') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/MotorControl/motorControl.cpp:147: [medium:warning] 100 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/MotorControl/motorControl.cpp:164: [medium:warning] missing username/bug in TODO [google-readability-todo]
|
||||||
|
lib/MotorControl/motorControl.cpp:165: [medium:warning] missing username/bug in TODO [google-readability-todo]
|
||||||
|
lib/Navigation/navigation.cpp:15: [medium:warning] 'sensorData' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Navigation/navigation.cpp:20: [medium:warning] implicit conversion 'Route *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Navigation/navigation.cpp:20: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Navigation/navigation.cpp:22: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Navigation/navigation.cpp:35: [medium:warning] 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
|
||||||
|
lib/Navigation/navigation.cpp:35: [medium:warning] implicit conversion 'Route *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Navigation/navigation.cpp:35: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Navigation/navigation.cpp:41: [medium:warning] variable 'newTargetPoint' of type 'Point' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Navigation/navigation.cpp:43: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Navigation/navigation.cpp:49: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Navigation/navigation.cpp:52: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Navigation/navigation.cpp:55: [medium:warning] 2.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Navigation/navigation.cpp:65: [medium:warning] redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr]
|
||||||
|
lib/Navigation/navigation.cpp:81: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Navigation/navigation.cpp:92: [medium:warning] variable 'distance' of type 'double' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Navigation/navigation.cpp:117: [medium:warning] variable 'targetCourse' of type 'int16_t' (aka 'short') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Navigation/navigation.cpp:118: [medium:warning] variable 'correctionCourse' is not initialized [cppcoreguidelines-init-variables]
|
||||||
|
lib/Navigation/navigation.cpp:134: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Navigation/navigation.cpp:148: [medium:warning] 180 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Navigation/navigation.cpp:148: [medium:warning] 180 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Navigation/navigation.cpp:149: [medium:warning] 180 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Navigation/navigation.cpp:149: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Navigation/navigation.cpp:150: [medium:warning] 360 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Navigation/navigation.cpp:151: [medium:warning] 180 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Navigation/navigation.cpp:151: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Navigation/navigation.cpp:152: [medium:warning] 360 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Navigation/navigation.h:86: [medium:warning] missing username/bug in TODO [google-readability-todo]
|
||||||
|
lib/Navigation/navigation.h:99: [medium:warning] missing username/bug in TODO [google-readability-todo]
|
||||||
|
lib/Network/network.cpp:14: [medium:warning] constructor does not initialize these fields: mqttUser, mqttPassphrase [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/Network/network.cpp:15: [medium:warning] static member accessed through instance [readability-static-accessed-through-instance]
|
||||||
|
lib/Network/network.cpp:15: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Network/network.cpp:21: [medium:warning] constructor does not initialize these fields: mqttUser, mqttPassphrase [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/Network/network.cpp:22: [medium:warning] 'adresses' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Network/network.cpp:22: [medium:warning] parameter 'adresses' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]
|
||||||
|
lib/Network/network.cpp:24: [medium:warning] static member accessed through instance [readability-static-accessed-through-instance]
|
||||||
|
lib/Network/network.cpp:24: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Network/network.cpp:39: [medium:warning] 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
|
||||||
|
lib/Network/network.cpp:39: [medium:warning] implicit conversion 'PubSubClient *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Network/network.cpp:39: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Network/network.cpp:52: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Network/network.cpp:52: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Network/network.cpp:52: [medium:warning] 6 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Network/network.cpp:65: [medium:warning] 2 adjacent parameters of 'activateMqtt' of similar type ('const char *') are easily swapped by mistake [bugprone-easily-swappable-parameters]
|
||||||
|
lib/Network/network.cpp:73: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Network/network.cpp:78: [medium:warning] method 'printIPs' can be made const [readability-make-member-function-const]
|
||||||
|
lib/Network/network.cpp:91: [medium:warning] variable 'channel' is not initialized [cppcoreguidelines-init-variables]
|
||||||
|
lib/Network/network.cpp:92: [medium:warning] variable 'secondChannel' is not initialized [cppcoreguidelines-init-variables]
|
||||||
|
lib/Network/network.cpp:102: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Network/network.cpp:107: [medium:warning] implicit conversion 'PubSubClient *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Network/network.cpp:107: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Network/network.cpp:116: [medium:warning] static member accessed through instance [readability-static-accessed-through-instance]
|
||||||
|
lib/Network/network.cpp:132: [medium:warning] static member accessed through instance [readability-static-accessed-through-instance]
|
||||||
|
lib/Network/network.cpp:150: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Network/network.cpp:156: [medium:warning] 0xffff is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Network/network.cpp:158: [medium:warning] implicit conversion 'const char *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Network/network.cpp:159: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Network/network.cpp:162: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:15: [medium:warning] constructor does not initialize these fields: host, mountPoint, user, password [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/NtripClient/ntripClient.cpp:16: [medium:warning] 'gps' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/NtripClient/ntripClient.cpp:17: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:18: [medium:warning] 'port' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/NtripClient/ntripClient.cpp:19: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:20: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:21: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:23: [medium:warning] 'ntripClient' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/NtripClient/ntripClient.cpp:24: [medium:warning] 'state' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/NtripClient/ntripClient.cpp:26: [medium:warning] 20 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/NtripClient/ntripClient.cpp:53: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:64: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:66: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:86: [medium:warning] use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
|
||||||
|
lib/NtripClient/ntripClient.cpp:90: [medium:warning] 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/NtripClient/ntripClient.cpp:95: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:97: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:122: [medium:warning] implicit conversion 'int' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/NtripClient/ntripClient.cpp:122: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:125: [medium:warning] do not use 'else' after 'return' [readability-else-after-return]
|
||||||
|
lib/NtripClient/ntripClient.cpp:130: [medium:warning] the value returned by this function should be used [cert-err33-c]
|
||||||
|
lib/NtripClient/ntripClient.cpp:130: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:133: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:136: [medium:warning] variable 'userCredentialsLength' of type 'uint8_t' (aka 'unsigned char') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/NtripClient/ntripClient.cpp:136: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:136: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:138: [medium:warning] the value returned by this function should be used [cert-err33-c]
|
||||||
|
lib/NtripClient/ntripClient.cpp:138: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:138: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:143: [medium:warning] variable 'b' of type 'base64' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/NtripClient/ntripClient.cpp:143: [medium:warning] variable name 'b' is too short, expected at least 3 characters [readability-identifier-length]
|
||||||
|
lib/NtripClient/ntripClient.cpp:144: [medium:warning] variable 'strEncodedCredentials' of type 'String' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/NtripClient/ntripClient.cpp:144: [medium:warning] static member accessed through instance [readability-static-accessed-through-instance]
|
||||||
|
lib/NtripClient/ntripClient.cpp:147: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:149: [medium:warning] the value returned by this function should be used [cert-err33-c]
|
||||||
|
lib/NtripClient/ntripClient.cpp:149: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:149: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:153: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:153: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:154: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:157: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:165: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:168: [medium:warning] variable 'lastMillis' of type 'uint32_t' (aka 'unsigned int') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/NtripClient/ntripClient.cpp:169: [medium:warning] implicit conversion 'int' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/NtripClient/ntripClient.cpp:175: [medium:warning] 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/NtripClient/ntripClient.cpp:182: [medium:warning] implicit conversion 'int' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/NtripClient/ntripClient.cpp:183: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:189: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:189: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:190: [medium:warning] 200 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/NtripClient/ntripClient.cpp:191: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:191: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:192: [medium:warning] 401 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/NtripClient/ntripClient.cpp:199: [medium:warning] 200 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/NtripClient/ntripClient.cpp:200: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
lib/NtripClient/ntripClient.cpp:203: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:205: [medium:warning] 401 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/NtripClient/ntripClient.cpp:205: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:216: [medium:warning] implicit conversion 'uint8_t' (aka 'unsigned char') -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/NtripClient/ntripClient.cpp:216: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:223: [medium:warning] implicit conversion 'uint8_t' (aka 'unsigned char') -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/NtripClient/ntripClient.cpp:224: [medium:warning] 8 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/NtripClient/ntripClient.cpp:227: [medium:warning] implicit conversion 'int' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/NtripClient/ntripClient.cpp:229: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:235: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/NtripClient/ntripClient.cpp:252: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:255: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:269: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:272: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:276: [medium:warning] implicit conversion 'uint8_t' (aka 'unsigned char') -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/NtripClient/ntripClient.cpp:276: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:279: [medium:warning] use auto when initializing with new to avoid duplicating the type name [hicpp-use-auto,modernize-use-auto]
|
||||||
|
lib/NtripClient/ntripClient.cpp:280: [medium:warning] variable 'res' of type 'uint8_t' (aka 'unsigned char') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/NtripClient/ntripClient.cpp:281: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:282: [medium:warning] do not use C-style cast to convert between unrelated types [cppcoreguidelines-pro-type-cstyle-cast]
|
||||||
|
lib/NtripClient/ntripClient.cpp:282: [medium:warning] C-style casts are discouraged; use reinterpret_cast [google-readability-casting]
|
||||||
|
lib/NtripClient/ntripClient.cpp:287: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/NtripClient/ntripClient.cpp:288: [medium:warning] redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
|
||||||
|
lib/Point/point.cpp:14: [medium:warning] constructor does not initialize these fields: coordinates [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/Point/point.cpp:14: [medium:warning] 3 adjacent parameters of 'Point' of convertible types are easily swapped by mistake [bugprone-easily-swappable-parameters]
|
||||||
|
lib/Point/point.cpp:20: [medium:warning] constructor does not initialize these fields: coordinates [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/Point/point.cpp:20: [medium:warning] 3 adjacent parameters of 'Point' of convertible types are easily swapped by mistake [bugprone-easily-swappable-parameters]
|
||||||
|
lib/Point/point.cpp:21: [medium:warning] 10000000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Point/point.cpp:22: [medium:warning] 10000000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Point/point.cpp:26: [medium:warning] constructor does not initialize these fields: coordinates [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/Point/point.cpp:27: [medium:warning] 'coordinates' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Point/point.cpp:31: [medium:warning] constructor does not initialize these fields: coordinates [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/Point/point.cpp:32: [medium:warning] 'coordinates' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Point/point.cpp:33: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Point/point.cpp:35: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Point/point.cpp:39: [medium:warning] constructor does not initialize these fields: coordinates [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/Point/point.cpp:56: [medium:warning] variable 'begin' of type 'Point::Coordinates' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Point/point.cpp:57: [medium:warning] variable 'end' of type 'Point::Coordinates' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Point/point.cpp:59: [medium:warning] variable 'lat' of type 'double' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Point/point.cpp:60: [medium:warning] variable 'dy' of type 'double' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Point/point.cpp:60: [medium:warning] variable name 'dy' is too short, expected at least 3 characters [readability-identifier-length]
|
||||||
|
lib/Point/point.cpp:61: [medium:warning] variable 'dx' of type 'double' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Point/point.cpp:61: [medium:warning] variable name 'dx' is too short, expected at least 3 characters [readability-identifier-length]
|
||||||
|
lib/Point/point.cpp:71: [medium:warning] variable 'begin' of type 'Point::Coordinates' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Point/point.cpp:72: [medium:warning] variable 'end' of type 'Point::Coordinates' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Point/point.cpp:74: [medium:warning] variable 'phi' of type 'double' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Point/point.cpp:75: [medium:warning] variable 'lon' of type 'double' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Point/point.cpp:77: [medium:warning] variable 'res' of type 'int16_t' (aka 'short') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Point/point.cpp:89: [medium:warning] 2 adjacent parameters of 'init' of similar type ('uint32_t') are easily swapped by mistake [bugprone-easily-swappable-parameters]
|
||||||
|
lib/Point/point.cpp:92: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Point/point.cpp:94: [medium:warning] 9999 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Point/point.cpp:94: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Point/point.cpp:96: [medium:warning] 999 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Point/point.cpp:96: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Point/point.cpp:98: [medium:warning] 99 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Point/point.cpp:98: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Point/point.cpp:100: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Point/point.cpp:102: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Route/route.cpp:14: [medium:warning] use '= default' to define a trivial default constructor [hicpp-use-equals-default,modernize-use-equals-default]
|
||||||
|
lib/Route/route.cpp:29: [medium:warning] the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
|
||||||
|
lib/Route/route.cpp:31: [medium:warning] avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
|
||||||
|
lib/Route/route.cpp:41: [medium:warning] the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
|
||||||
|
lib/Route/route.cpp:43: [medium:warning] avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
|
||||||
|
lib/Route/route.cpp:47: [medium:warning] missing username/bug in TODO [google-readability-todo]
|
||||||
|
lib/Route/route.cpp:55: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Route/route.cpp:56: [medium:warning] avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
|
||||||
|
lib/Route/route.cpp:67: [medium:warning] avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
|
||||||
|
lib/Route/route.cpp:71: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Route/route.cpp:72: [medium:warning] avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
|
||||||
|
lib/Route/route.cpp:78: [medium:warning] do not use 'else' after 'return' [readability-else-after-return]
|
||||||
|
lib/Route/route.cpp:79: [medium:warning] avoid repeating the return type from the declaration; use a braced initializer list instead [modernize-return-braced-init-list]
|
||||||
|
lib/Route/route.cpp:84: [medium:warning] uninitialized record type: 'info' [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/Sensors/sensorData.cpp:18: [medium:warning] constructor does not initialize these fields: gnssData, host, mountPoint, user, password, gyroBuffer, port [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/Sensors/sensorData.cpp:19: [medium:warning] 50 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:23: [medium:warning] 'if' statement is unnecessary; deleting null pointer has no effect [readability-delete-null-pointer]
|
||||||
|
lib/Sensors/sensorData.cpp:23: [medium:warning] implicit conversion 'NTRIPClient *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Sensors/sensorData.cpp:23: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:27: [medium:warning] the parameter 'host' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
|
||||||
|
lib/Sensors/sensorData.cpp:27: [medium:warning] the parameter 'mountPoint' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
|
||||||
|
lib/Sensors/sensorData.cpp:27: [medium:warning] the parameter 'user' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
|
||||||
|
lib/Sensors/sensorData.cpp:27: [medium:warning] the parameter 'password' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
|
||||||
|
lib/Sensors/sensorData.cpp:38: [medium:warning] 4000000 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:38: [medium:warning] redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr]
|
||||||
|
lib/Sensors/sensorData.cpp:40: [medium:warning] converting integer literal to bool, use bool literal instead [modernize-use-bool-literals]
|
||||||
|
lib/Sensors/sensorData.cpp:40: [medium:warning] implicit conversion 'int' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Sensors/sensorData.cpp:40: [medium:warning] statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:47: [medium:warning] redundant boolean literal supplied to boolean operator [readability-simplify-boolean-expr]
|
||||||
|
lib/Sensors/sensorData.cpp:49: [medium:warning] converting integer literal to bool, use bool literal instead [modernize-use-bool-literals]
|
||||||
|
lib/Sensors/sensorData.cpp:49: [medium:warning] implicit conversion 'int' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Sensors/sensorData.cpp:49: [medium:warning] statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:57: [medium:warning] 0x0d is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:58: [medium:warning] 0x0b is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:61: [medium:warning] 0x0C is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:61: [medium:warning] 0x10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:76: [medium:warning] statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:79: [medium:warning] variable 'deviceStatus' of type 'uint8_t' (aka 'unsigned char') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Sensors/sensorData.cpp:81: [medium:warning] 220 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:82: [medium:warning] 76 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:83: [medium:warning] 85 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:84: [medium:warning] 1788 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:87: [medium:warning] 6 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:88: [medium:warning] 6 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:96: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
lib/Sensors/sensorData.cpp:97: [medium:warning] statement should be inside braces [hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:102: [medium:warning] implicit conversion 'CalcAzimuth *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Sensors/sensorData.cpp:102: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:108: [medium:warning] implicit conversion 'NTRIPClient *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Sensors/sensorData.cpp:108: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:114: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:117: [medium:warning] variable 'latitude' of type 'double' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Sensors/sensorData.cpp:117: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
lib/Sensors/sensorData.cpp:117: [medium:warning] 10000000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:118: [medium:warning] variable 'longitude' of type 'double' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Sensors/sensorData.cpp:118: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
lib/Sensors/sensorData.cpp:118: [medium:warning] 10000000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:119: [medium:warning] variable 'altitude' of type 'double' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Sensors/sensorData.cpp:119: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
lib/Sensors/sensorData.cpp:119: [medium:warning] 1000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:121: [medium:warning] variable 'fixType' of type 'uint8_t' (aka 'unsigned char') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Sensors/sensorData.cpp:122: [medium:warning] 32 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:123: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:124: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:125: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:126: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:127: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:128: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:129: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:130: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:131: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:132: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:133: [medium:warning] 5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:133: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:134: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:135: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:136: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:138: [medium:warning] variable 'carrSoln' of type 'uint8_t' (aka 'unsigned char') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Sensors/sensorData.cpp:138: [medium:warning] do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
|
||||||
|
lib/Sensors/sensorData.cpp:139: [medium:warning] 16 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:140: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:141: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:142: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:143: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:144: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:145: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:146: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:147: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:149: [medium:warning] variable 'hAcc' of type 'uint32_t' (aka 'unsigned int') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Sensors/sensorData.cpp:172: [medium:warning] implicit conversion 'QMC5883LCompass *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Sensors/sensorData.cpp:177: [medium:warning] implicit conversion 'MPU6050 *' (aka 'MPU6050_6Axis_MotionApps20 *') -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Sensors/sensorData.cpp:178: [medium:warning] implicit conversion 'uint8_t' (aka 'unsigned char') -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Sensors/sensorData.cpp:178: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:180: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:182: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
lib/Sensors/sensorData.cpp:187: [medium:warning] implicit conversion 'SFE_UBLOX_GNSS *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/Sensors/sensorData.cpp:190: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Sensors/sensorData.cpp:196: [medium:warning] variable 'versionHigh' of type 'uint8_t' (aka 'unsigned char') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Sensors/sensorData.cpp:197: [medium:warning] variable 'versionLow' of type 'uint8_t' (aka 'unsigned char') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Sensors/sensorData.cpp:198: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
lib/Sensors/sensorData.cpp:198: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
lib/Sensors/sensorData.cpp:201: [medium:warning] 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:213: [medium:warning] uninitialized record type: 'coords' [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/Sensors/sensorData.cpp:214: [medium:warning] 10000000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Sensors/sensorData.cpp:215: [medium:warning] 10000000.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Speedometer/speedometer.cpp:14: [medium:warning] constructor does not initialize these fields: buf [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/Speedometer/speedometer.cpp:14: [medium:warning] 3 adjacent parameters of 'Speedometer' of convertible types are easily swapped by mistake [bugprone-easily-swappable-parameters]
|
||||||
|
lib/Speedometer/speedometer.cpp:15: [medium:warning] 'diameter' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Speedometer/speedometer.cpp:16: [medium:warning] 'steps' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Speedometer/speedometer.cpp:18: [medium:warning] 'pulseCounter' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Speedometer/speedometer.cpp:19: [medium:warning] 1023 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Speedometer/speedometer.cpp:34: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Speedometer/speedometer.cpp:37: [medium:warning] variable 'time' of type 'uint32_t' (aka 'unsigned int') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Speedometer/speedometer.cpp:39: [medium:warning] variable 'elapsedTime' of type 'uint16_t' (aka 'unsigned short') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Speedometer/speedometer.cpp:42: [medium:warning] variable 'pulse' of type 'int16_t' (aka 'short') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Speedometer/speedometer.cpp:47: [medium:warning] variable 'n' of type 'double' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Speedometer/speedometer.cpp:47: [medium:warning] variable name 'n' is too short, expected at least 3 characters [readability-identifier-length]
|
||||||
|
lib/Speedometer/speedometer.cpp:47: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
lib/Speedometer/speedometer.cpp:48: [medium:warning] variable 'u' of type 'double' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Speedometer/speedometer.cpp:48: [medium:warning] variable name 'u' is too short, expected at least 3 characters [readability-identifier-length]
|
||||||
|
lib/Speedometer/speedometer.cpp:48: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
lib/Speedometer/speedometer.cpp:48: [medium:warning] 1000 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Speedometer/speedometer.cpp:49: [medium:warning] variable 'ms' of type 'double' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Speedometer/speedometer.cpp:49: [medium:warning] variable name 'ms' is too short, expected at least 3 characters [readability-identifier-length]
|
||||||
|
lib/Speedometer/speedometer.cpp:52: [medium:warning] 0.1 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Speedometer/speedometer.cpp:78: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Speedometer/speedometer.cpp:85: [medium:warning] 1023 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Speedometer/speedometer.cpp:85: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Speedometer/speedometer.cpp:86: [medium:warning] 1023 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
lib/Speedometer/speedometer.cpp:91: [medium:warning] variable 'avg' of type 'int16_t' (aka 'short') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Speedometer/speedometer.cpp:92: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
lib/Speedometer/speedometer.cpp:105: [medium:warning] variable 'res' of type 'uint16_t' (aka 'unsigned short') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Speedometer/speedometer.cpp:113: [medium:warning] use range-based for loop instead [modernize-loop-convert]
|
||||||
|
lib/Speedometer/speedometer.cpp:113: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Speedometer/speedometer.cpp:121: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Speedometer/speedometer.cpp:127: [medium:warning] static member accessed through instance [readability-static-accessed-through-instance]
|
||||||
|
lib/Speedometer/speedometer.cpp:127: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Speedometer/speedometer.cpp:129: [medium:warning] static member accessed through instance [readability-static-accessed-through-instance]
|
||||||
|
lib/Times/debugTimes.cpp:17: [medium:warning] 'startTime' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/Times/debugTimes.cpp:29: [medium:warning] method 'stop' can be made const [readability-make-member-function-const]
|
||||||
|
lib/Times/debugTimes.cpp:33: [medium:warning] method 'stopConsol' can be made const [readability-make-member-function-const]
|
||||||
|
lib/Times/debugTimes.cpp:34: [medium:warning] variable 'time' of type 'uint64_t' (aka 'unsigned long long') can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/Times/debugTimes.cpp:35: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/Times/debugTimes.cpp:41: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:14: [medium:warning] constructor does not initialize these fields: data [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:16: [medium:warning] 'compass' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:17: [medium:warning] 'state' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:32: [medium:warning] variable 'xAxis' of type 'int' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:33: [medium:warning] variable 'yAxis' of type 'int' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:34: [medium:warning] variable 'zAxis' of type 'int' can be declared 'const' [misc-const-correctness]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:72: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:164: [medium:warning] use range-based for loop instead [modernize-loop-convert]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:175: [medium:warning] use range-based for loop instead [modernize-loop-convert]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:185: [medium:warning] implicit conversion 'int' -> bool [readability-implicit-bool-conversion]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:188: [medium:warning] parameter name 'os' is too short, expected at least 3 characters [readability-identifier-length]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:191: [medium:warning] use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:193: [medium:warning] use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:195: [medium:warning] use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:197: [medium:warning] use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:199: [medium:warning] use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
|
||||||
|
lib/calibrateCompass/calibrateCompass.cpp:201: [medium:warning] use of a signed integer operand with a binary bitwise operator [hicpp-signed-bitwise]
|
||||||
|
src/OutputBuf/outputBuf.cpp:15: [medium:warning] initializer for base class 'std::streambuf' (aka 'basic_streambuf<char>') is redundant [readability-redundant-member-init]
|
||||||
|
src/OutputBuf/outputBuf.cpp:16: [medium:warning] 'debugMqtt' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
src/OutputBuf/outputBuf.cpp:17: [medium:warning] 'serialBT' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
src/OutputBuf/outputBuf.cpp:19: [medium:warning] implicit conversion 'DebugMqtt *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
src/OutputBuf/outputBuf.cpp:19: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/OutputBuf/outputBuf.cpp:22: [medium:warning] implicit conversion 'BluetoothSerial *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
src/OutputBuf/outputBuf.cpp:22: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/OutputBuf/outputBuf.cpp:27: [medium:warning] implicit conversion 'DebugMqtt *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
src/OutputBuf/outputBuf.cpp:27: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/OutputBuf/outputBuf.cpp:32: [medium:warning] implicit conversion 'BluetoothSerial *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
src/OutputBuf/outputBuf.cpp:32: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/OutputBuf/outputBuf.cpp:46: [medium:warning] parameter name 'c' is too short, expected at least 3 characters [readability-identifier-length]
|
||||||
|
src/OutputBuf/outputBuf.cpp:50: [medium:warning] implicit conversion 'DebugMqtt *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
src/OutputBuf/outputBuf.cpp:50: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/OutputBuf/outputBuf.cpp:51: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
src/OutputBuf/outputBuf.cpp:53: [medium:warning] implicit conversion 'BluetoothSerial *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
src/OutputBuf/outputBuf.cpp:53: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/OutputBuf/outputBuf.cpp:54: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
src/OutputBuf/outputBuf.cpp:56: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
src/SpecialMenus/CalibrateBattery/menuCalibrateBattery.cpp:15: [medium:warning] 400 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/CalibrateBattery/menuCalibrateBattery.cpp:16: [medium:warning] 'battery' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
src/SpecialMenus/CalibrateBattery/menuCalibrateBattery.cpp:20: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/CalibrateBattery/menuCalibrateBattery.cpp:52: [medium:warning] implicit conversion 'MenuControl *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
src/SpecialMenus/CalibrateBattery/menuCalibrateBattery.cpp:52: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/CalibrateBattery/menuCalibrateBattery.cpp:57: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/PID/menuPidSettings.cpp:15: [medium:warning] 'pid' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
src/SpecialMenus/PID/menuPidSettings.cpp:19: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:16: [medium:warning] 'menuRoute' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:17: [medium:warning] 'dataFunction' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:25: [medium:warning] constructor does not initialize these fields: mainMenu [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:27: [medium:warning] 'route' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:163: [medium:warning] static member accessed through instance [readability-static-accessed-through-instance]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:188: [medium:warning] variable 'httpResponseCode' of type 'int' can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:193: [medium:warning] 202 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:216: [medium:warning] uninitialized record type: 'coords' [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:229: [medium:warning] variable 'totalPoints' of type 'uint16_t' (aka 'unsigned short') can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:234: [medium:warning] static member accessed through instance [readability-static-accessed-through-instance]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:273: [medium:warning] variable 'httpResponseCode' of type 'int' can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:275: [medium:warning] 201 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:298: [medium:warning] static member accessed through instance [readability-static-accessed-through-instance]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:323: [medium:warning] variable 'httpResponseCode' of type 'int' can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/Route/menuRoute.cpp:328: [medium:warning] 202 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:14: [medium:warning] initializer for base class 'MenuInformationSites' is redundant [readability-redundant-member-init]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:15: [medium:warning] 'route' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:19: [medium:warning] variable 'amountPoints' of type 'uint16_t' (aka 'unsigned short') can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:20: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:22: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:27: [medium:warning] variable 'currentPage' of type 'uint8_t' (aka 'unsigned char') can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:28: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:49: [medium:warning] variable name 'p' is too short, expected at least 3 characters [readability-identifier-length]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:50: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:52: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:54: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:56: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:58: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:61: [medium:warning] 20 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:62: [medium:warning] variable 'string' is not initialized [cppcoreguidelines-init-variables]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:65: [medium:warning] 9 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:65: [medium:warning] 7 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:65: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:70: [medium:warning] 9 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:70: [medium:warning] 7 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Route/menuRoutePoints.cpp:70: [medium:warning] do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay,hicpp-no-array-decay]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:15: [medium:warning] 7 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:16: [medium:warning] 'sensorData' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:20: [medium:warning] function 'printPage' has cognitive complexity of 26 (threshold 25) [readability-function-cognitive-complexity]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:23: [medium:warning] implicit conversion 'const UBX_NAV_PVT_data_t *' -> bool [readability-implicit-bool-conversion]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:23: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:54: [medium:warning] variable 'pos' of type 'Point' can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:63: [medium:warning] implicit conversion 'uint8_t' (aka 'unsigned char') -> bool [readability-implicit-bool-conversion]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:64: [medium:warning] 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:64: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:68: [medium:warning] 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:68: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:72: [medium:warning] 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:72: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:75: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:80: [medium:warning] 5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:83: [medium:warning] variable 'carrSoln' of type 'uint8_t' (aka 'unsigned char') can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:83: [medium:warning] do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:84: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:86: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:88: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:90: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:92: [medium:warning] variable 'status' of type 'NTRIPClientStates' can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:93: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:95: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:97: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:102: [medium:warning] 6 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/SensorData/menuSensorData.cpp:105: [medium:warning] implicit conversion 'uint8_t' (aka 'unsigned char') -> bool [readability-implicit-bool-conversion]
|
||||||
|
src/SpecialMenus/Speed/menuSpeed.cpp:15: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/Speed/menuSpeed.cpp:17: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
src/SpecialMenus/Speed/menuSpeed.cpp:17: [medium:warning] 10.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Speed/menuSpeed.cpp:18: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
src/SpecialMenus/Speed/menuSpeed.cpp:18: [medium:warning] 10.0 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Systeminformation/menuSysteminformatio.cpp:15: [medium:warning] 8 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Systeminformation/menuSysteminformatio.cpp:16: [medium:warning] 'mainBattery' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]
|
||||||
|
src/SpecialMenus/Systeminformation/menuSysteminformatio.cpp:36: [medium:warning] 1000 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Systeminformation/menuSysteminformatio.cpp:53: [medium:warning] 5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Systeminformation/menuSysteminformatio.cpp:58: [medium:warning] 6 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Systeminformation/menuSysteminformatio.cpp:60: [medium:warning] 16 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/Systeminformation/menuSysteminformatio.cpp:63: [medium:warning] 7 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:14: [medium:warning] function 'printPage' has cognitive complexity of 36 (threshold 25) [readability-function-cognitive-complexity]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:15: [medium:warning] variable 'correction' of type 'CourseCorrection' can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:17: [medium:warning] variable 'navigationStarted' of type 'bool' can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:23: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:23: [medium:warning] 100 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:26: [medium:warning] 1000 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:27: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:31: [medium:warning] C-style casts are discouraged; use static_cast [google-readability-casting]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:31: [medium:warning] 1000 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:108: [medium:warning] variable 'carrSoln' of type 'uint8_t' (aka 'unsigned char') can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:108: [medium:warning] do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:111: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:112: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:114: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:116: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:118: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:120: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:122: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:126: [medium:warning] implicit conversion 'uint8_t' (aka 'unsigned char') -> bool [readability-implicit-bool-conversion]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:126: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:128: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:173: [medium:warning] 5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:175: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:177: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:181: [medium:warning] 6 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:183: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:185: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:189: [medium:warning] 7 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:206: [medium:warning] 5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:210: [medium:warning] 6 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:220: [medium:warning] 7 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:231: [medium:warning] 7 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:241: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/Autopilot/menuAutopilot.cpp:249: [medium:warning] 8 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.cpp:13: [medium:warning] constructor does not initialize these fields: caliCompassMode, caliCompass [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
src/SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.cpp:67: [medium:warning] 5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.cpp:72: [medium:warning] 6 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.cpp:77: [medium:warning] 7 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.cpp:82: [medium:warning] 8 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.cpp:89: [medium:warning] 9 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.cpp:96: [medium:warning] 10 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.cpp:116: [medium:warning] 11 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.cpp:117: [medium:warning] 500 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.cpp:147: [medium:warning] 5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.cpp:151: [medium:warning] 6 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CalibrateCompass/menuCalibrateCompass.cpp:155: [medium:warning] 7 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:14: [medium:warning] variable 'routeInfo' of type 'RouteInfo' can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:62: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:64: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:66: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:71: [medium:warning] 5 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:73: [medium:warning] variable 'carrSoln' of type 'uint8_t' (aka 'unsigned char') can be declared 'const' [misc-const-correctness]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:73: [medium:warning] do not access members of unions; use (boost::)variant instead [cppcoreguidelines-pro-type-union-access]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:74: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:76: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:78: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:80: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:85: [medium:warning] 6 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:89: [medium:warning] implicit conversion 'uint8_t' (aka 'unsigned char') -> bool [readability-implicit-bool-conversion]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:89: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:91: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:95: [medium:warning] 7 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:97: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:99: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:112: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:120: [medium:warning] 7 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:121: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:123: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:133: [medium:warning] 8 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute/menuCaptureRoute.cpp:134: [medium:warning] 500 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers]
|
||||||
|
src/SpecialMenus/driveModi/ManualDrive/menuManualDrive.cpp:13: [medium:warning] constructor does not initialize these fields: manualControl, caliCompass [cppcoreguidelines-pro-type-member-init,hicpp-member-init]
|
||||||
|
src/SpecialMenus/driveModi/ManualDrive/menuManualDrive.cpp:17: [medium:warning] use '= default' to define a trivial destructor [hicpp-use-equals-default,modernize-use-equals-default]
|
||||||
|
src/SpecialMenus/driveModi/ManualDrive/menuManualDrive.cpp:31: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/ManualDrive/menuManualDrive.cpp:33: [medium:warning] statement should be inside braces [google-readability-braces-around-statements,hicpp-braces-around-statements,readability-braces-around-statements]
|
||||||
|
src/SpecialMenus/driveModi/ManualDrive/menuManualDrive.cpp:58: [medium:warning] 500 is a magic number; consider replacing it with a named constant
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
========================= [PASSED] Took 541.63 seconds =========================
|
||||||
|
|
||||||
|
Component HIGH MEDIUM LOW
|
||||||
|
------------------------------------------- ------ -------- -----
|
||||||
|
include 0 4 0
|
||||||
|
lib/Battery 0 85 0
|
||||||
|
lib/CalcAzimuth 0 9 0
|
||||||
|
lib/Component 0 10 0
|
||||||
|
lib/ControllPad 0 27 0
|
||||||
|
lib/Counter 0 9 0
|
||||||
|
lib/LcdWrapper 0 23 0
|
||||||
|
lib/MQTT 0 42 0
|
||||||
|
lib/Menu/include 0 13 0
|
||||||
|
lib/Menu/src 0 188 0
|
||||||
|
lib/MotorControl 0 38 0
|
||||||
|
lib/Navigation 0 41 0
|
||||||
|
lib/Network 0 36 0
|
||||||
|
lib/NtripClient 0 98 0
|
||||||
|
lib/Point 0 42 0
|
||||||
|
lib/Route 0 20 0
|
||||||
|
lib/Sensors 0 108 0
|
||||||
|
lib/Speedometer 0 44 0
|
||||||
|
lib/Times 0 11 0
|
||||||
|
lib/calibrateCompass 0 28 0
|
||||||
|
src 0 129 0
|
||||||
|
src/OutputBuf 0 22 0
|
||||||
|
src/SpecialMenus/CalibrateBattery 0 8 0
|
||||||
|
src/SpecialMenus/PID 0 7 0
|
||||||
|
src/SpecialMenus/Route 0 62 0
|
||||||
|
src/SpecialMenus/SensorData 0 32 0
|
||||||
|
src/SpecialMenus/Speed 0 9 0
|
||||||
|
src/SpecialMenus/Systeminformation 0 9 0
|
||||||
|
src/SpecialMenus/driveModi 0 26 0
|
||||||
|
src/SpecialMenus/driveModi/Autopilot 0 37 0
|
||||||
|
src/SpecialMenus/driveModi/CalibrateCompass 0 16 0
|
||||||
|
src/SpecialMenus/driveModi/CaptureRoute 0 27 0
|
||||||
|
src/SpecialMenus/driveModi/ManualDrive 0 8 0
|
||||||
|
src/SpecialMenus/driveModi/TestMode 0 108 0
|
||||||
|
src/driveModi 0 6 0
|
||||||
|
src/driveModi/Modi/Autopilot 0 20 0
|
||||||
|
src/driveModi/Modi/CalibrateCompass 0 2 0
|
||||||
|
src/driveModi/Modi/CaptureRoute 0 7 0
|
||||||
|
src/driveModi/Modi/ManualControl 0 9 0
|
||||||
|
src/driveModi/Modi/TestMode 0 31 0
|
||||||
|
|
||||||
|
Total 0 1451 0
|
||||||
|
|
||||||
|
Environment Tool Status Duration
|
||||||
|
------------- --------- -------- ------------
|
||||||
|
embedded clangtidy PASSED 00:09:01.626
|
||||||
|
========================= 1 succeeded in 00:09:01.626 =========================
|
||||||
@@ -16,6 +16,9 @@ namespace PinNumbers {
|
|||||||
constexpr uint8_t spiCipo = 4;
|
constexpr uint8_t spiCipo = 4;
|
||||||
constexpr uint8_t spiSck = 5;
|
constexpr uint8_t spiSck = 5;
|
||||||
constexpr uint8_t gnssSpiCs = 17;
|
constexpr uint8_t gnssSpiCs = 17;
|
||||||
|
constexpr uint8_t sda = 21;
|
||||||
|
constexpr uint8_t scl = 19;
|
||||||
|
constexpr uint8_t battery = 35;
|
||||||
|
|
||||||
namespace LeftMotor {
|
namespace LeftMotor {
|
||||||
constexpr uint8_t dir1 = 27;
|
constexpr uint8_t dir1 = 27;
|
||||||
@@ -35,6 +38,9 @@ namespace PinNumbers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace Settings {
|
namespace Settings {
|
||||||
|
constexpr uint32_t baudRate = 115200;
|
||||||
|
constexpr uint32_t i2cSpeed = 400000;
|
||||||
|
|
||||||
constexpr float wheelDiameter = 0.105;
|
constexpr float wheelDiameter = 0.105;
|
||||||
constexpr float wheelDistance = 0.255;
|
constexpr float wheelDistance = 0.255;
|
||||||
constexpr uint16_t encoderSteps = 384;
|
constexpr uint16_t encoderSteps = 384;
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class MoveControl : public Component {
|
|||||||
* @param i
|
* @param i
|
||||||
* @param d
|
* @param d
|
||||||
*/
|
*/
|
||||||
void setPidTunings(uint8_t side, double p, double i, double d);
|
void setPidTunings(uint8_t side, double pPart, double iPart, double dPart);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the PID object of the choosen side.
|
* @brief Returns the PID object of the choosen side.
|
||||||
@@ -152,7 +152,7 @@ class MoveControl : public Component {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void run() override;
|
void run() override;
|
||||||
void setSpeedometerDirection(Speedometer *speedometer, double value);
|
static void setSpeedometerDirection(Speedometer *speedometer, double value);
|
||||||
void calcTargetWheelSpeed();
|
void calcTargetWheelSpeed();
|
||||||
void regulateMotors();
|
void regulateMotors();
|
||||||
void updateCurrentWheelSpeed();
|
void updateCurrentWheelSpeed();
|
||||||
@@ -171,12 +171,17 @@ class MoveControl : public Component {
|
|||||||
double wheelspeed_right_target = 0;
|
double wheelspeed_right_target = 0;
|
||||||
double wheelspeed_left = 0;
|
double wheelspeed_left = 0;
|
||||||
double wheelspeed_right = 0;
|
double wheelspeed_right = 0;
|
||||||
double left_pid_out;
|
double left_pid_out = 0;
|
||||||
double right_pid_out;
|
double right_pid_out = 0;
|
||||||
|
|
||||||
uint8_t overTimeCounter = 0;
|
uint8_t overTimeCounter = 0;
|
||||||
uint8_t overTimeMax = 100;
|
uint8_t overTimeMax = 100;
|
||||||
int8_t rawPowerLeft = 0;
|
int8_t rawPowerLeft = 0;
|
||||||
int8_t rawPowerRight = 0;
|
int8_t rawPowerRight = 0;
|
||||||
|
|
||||||
|
static constexpr int8_t maxPercentage = 100;
|
||||||
|
static constexpr float minSpeed = 0.2;
|
||||||
|
static constexpr uint8_t loopDelay = 20;
|
||||||
|
|
||||||
};
|
};
|
||||||
#endif // MOVE_CONTROL_H
|
#endif // MOVE_CONTROL_H
|
||||||
|
|||||||
+118
-78
@@ -4,30 +4,32 @@
|
|||||||
* @brief Contains the implementation of the class Battery
|
* @brief Contains the implementation of the class Battery
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2022-02-05
|
* @date 2022-02-05
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2022
|
* @copyright Copyright (c) 2022
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "battery.h"
|
#include "battery.h"
|
||||||
|
|
||||||
Battery::Battery(uint8_t pin, uint32_t r1, uint32_t r2) {
|
Battery::Battery(uint8_t pin, uint32_t firstResistor, uint32_t secondResistor)
|
||||||
this->pin = pin;
|
: pin{pin}, firstResistor{firstResistor}, secondResistor{secondResistor},
|
||||||
this->r1 = r1;
|
batteryVoltageFactor{firstResistor + secondResistor / static_cast<double>(secondResistor)}
|
||||||
this->r2 = r2;
|
{
|
||||||
this->batteryVoltageFactor = (double) (this->r1 + this->r2) / (double) this->r2;
|
|
||||||
this->initBuffer();
|
this->initBuffer();
|
||||||
this->loopDelay = 100;
|
Component::loopDelay = Battery::loopDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
Battery::Battery(uint8_t pin) {
|
Battery::Battery(uint8_t pin)
|
||||||
this->pin = pin;
|
: pin{pin}
|
||||||
|
{
|
||||||
this->initBuffer();
|
this->initBuffer();
|
||||||
this->loopDelay = 100;
|
Component::loopDelay = Battery::loopDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battery::run() {
|
void Battery::run()
|
||||||
if (this->calibrationState != CalibrationState::None) {
|
{
|
||||||
|
if (this->calibrationState != CalibrationState::None)
|
||||||
|
{
|
||||||
this->runCalibration();
|
this->runCalibration();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -35,164 +37,202 @@ void Battery::run() {
|
|||||||
this->readAdcToBuf();
|
this->readAdcToBuf();
|
||||||
this->loopCounter++;
|
this->loopCounter++;
|
||||||
|
|
||||||
if (this->loopCounter >= this->calulationDelayMultiplier) {
|
if (this->loopCounter >= this->calulationDelayMultiplier)
|
||||||
|
{
|
||||||
this->calculateBatteryVoltage();
|
this->calculateBatteryVoltage();
|
||||||
this->calculateBatteryPercent();
|
this->calculateBatteryPercent();
|
||||||
this->loopCounter = 0;
|
this->loopCounter = 0;
|
||||||
this->calculatetNewValues = true;
|
this->calculatetNewValues = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battery::runCalibration() {
|
void Battery::runCalibration()
|
||||||
|
{
|
||||||
if (this->calibrationState != CalibrationState::Reading)
|
if (this->calibrationState != CalibrationState::Reading)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->readAdcToBuf();
|
this->readAdcToBuf();
|
||||||
if (this->bufferPos == 0) {
|
if (this->bufferPos == 0)
|
||||||
uint16_t res = this->getBufAvg();
|
{
|
||||||
|
const uint16_t res = this->getBufAvg();
|
||||||
this->newRawAdcVoltages[this->currentCalibrationVoltage] = res;
|
this->newRawAdcVoltages[this->currentCalibrationVoltage] = res;
|
||||||
std::cout << "Index: "
|
std::cout << "Index: "
|
||||||
<< (int) this->currentCalibrationVoltage
|
<< (int)this->currentCalibrationVoltage
|
||||||
<< " Value: "
|
<< " Value: "
|
||||||
<< (int) res
|
<< (int)res
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
this->currentCalibrationVoltage++;
|
this->currentCalibrationVoltage++;
|
||||||
this->calibrationState = CalibrationState::Waiting;
|
this->calibrationState = CalibrationState::Waiting;
|
||||||
|
|
||||||
if (this->currentCalibrationVoltage == 60) {
|
if (this->currentCalibrationVoltage == Battery::rawAdcVoltagesCount)
|
||||||
|
{
|
||||||
this->calibrationState = CalibrationState::Finished;
|
this->calibrationState = CalibrationState::Finished;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
double Battery::getBatteryVoltage() const {
|
double Battery::getBatteryVoltage() const
|
||||||
double res = this->batteryVoltage;
|
{
|
||||||
return (int)(res*100+0.5)/100.0;
|
return static_cast<int>((this->batteryVoltage * 100 + 0.5)) / 100.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Battery::isBatteryLow(double voltage) const {
|
bool Battery::isBatteryLow(double voltage) const
|
||||||
|
{
|
||||||
if (this->getBatteryVoltage() <= voltage && this->batteryVoltage > this->absurdLowVoltage)
|
if (this->getBatteryVoltage() <= voltage && this->batteryVoltage > this->absurdLowVoltage)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Battery::isNewValue() {
|
bool Battery::isNewValue()
|
||||||
|
{
|
||||||
if (!this->calculatetNewValues)
|
if (!this->calculatetNewValues)
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
this->calculatetNewValues = false;
|
this->calculatetNewValues = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battery::nextVoltageIsReady() {
|
void Battery::nextVoltageIsReady()
|
||||||
if (this->calibrationState == CalibrationState::Waiting) {
|
{
|
||||||
|
if (this->calibrationState == CalibrationState::Waiting)
|
||||||
|
{
|
||||||
this->calibrationState = CalibrationState::Reading;
|
this->calibrationState = CalibrationState::Reading;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battery::startCalibration() {
|
void Battery::startCalibration()
|
||||||
|
{
|
||||||
this->calibrationState = CalibrationState::Waiting;
|
this->calibrationState = CalibrationState::Waiting;
|
||||||
this->currentCalibrationVoltage = 0;
|
this->currentCalibrationVoltage = 0;
|
||||||
this->bufferPos = 0;
|
this->bufferPos = 0;
|
||||||
this->loopDelay = 50;
|
Component::loopDelay = Battery::loopDelay / 2;
|
||||||
this->newRawAdcVoltages = new uint16_t[60];
|
this->newRawAdcVoltages = new uint16_t[Battery::rawAdcVoltagesCount];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battery::finishCalibration() {
|
void Battery::finishCalibration()
|
||||||
|
{
|
||||||
if (this->calibrationState != CalibrationState::None)
|
if (this->calibrationState != CalibrationState::None)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
delete[] this->newRawAdcVoltages;
|
delete[] this->newRawAdcVoltages;
|
||||||
this->calibrationState = CalibrationState::None;
|
this->calibrationState = CalibrationState::None;
|
||||||
this->loopDelay = 100;
|
Component::loopDelay = Battery::loopDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Battery::calculateInputVoltage() {
|
double Battery::calculateInputVoltage()
|
||||||
|
{
|
||||||
// Reference voltage is 3v3 so maximum reading is 3v3 = 4095 in range 0 to 4095
|
// Reference voltage is 3v3 so maximum reading is 3v3 = 4095 in range 0 to 4095
|
||||||
double reading = this->getBufAvg();
|
double reading = this->getBufAvg();
|
||||||
if(reading < 1 || reading > 4095) return 0;
|
if (reading < 1 || reading > Battery::adcMaxValue)
|
||||||
return - 0.000000000000016 * pow(reading,4)
|
{
|
||||||
+ 0.000000000118171 * pow(reading,3)
|
return 0;
|
||||||
- 0.000000301211691 * pow(reading,2)
|
}
|
||||||
+ 0.001109019271794 * reading
|
|
||||||
+ 0.034143524634089;
|
return -this->adcCurveCoeficient[0] * pow(reading, 4) + this->adcCurveCoeficient[1] * pow(reading, 3) - this->adcCurveCoeficient[2] * pow(reading, 2) + this->adcCurveCoeficient[3] * reading + this->adcCurveCoeficient[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battery::calculateBatteryVoltage() {
|
void Battery::calculateBatteryVoltage()
|
||||||
if (this->r1 && this->r2) {
|
{
|
||||||
|
if (this->firstResistor && this->secondResistor)
|
||||||
|
{
|
||||||
this->batteryVoltage = this->calculateInputVoltage() * this->batteryVoltageFactor;
|
this->batteryVoltage = this->calculateInputVoltage() * this->batteryVoltageFactor;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t adcValue = this->getBufAvg();
|
const uint16_t adcValue = this->getBufAvg();
|
||||||
if (adcValue < this->rawAdcVoltages[0]) {
|
if (adcValue < this->rawAdcVoltages[0])
|
||||||
|
{
|
||||||
this->batteryVoltage = -1;
|
this->batteryVoltage = -1;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adcValue > this->rawAdcVoltages[this->rawAdcVoltagesCount] + 50) {
|
uint8_t index = 1;
|
||||||
this->batteryVoltage = -2;
|
for (; index < this->rawAdcVoltagesCount; index++)
|
||||||
return;
|
{
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t index;
|
|
||||||
for (index = 1; index < this->rawAdcVoltagesCount; index++) {
|
|
||||||
if (adcValue < this->rawAdcVoltages[index])
|
if (adcValue < this->rawAdcVoltages[index])
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
double indexDelta = this->rawAdcVoltages[index] - this->rawAdcVoltages[index - 1];
|
const double indexDelta = this->rawAdcVoltages[index] - this->rawAdcVoltages[index - 1];
|
||||||
double valueDelta = this->rawAdcVoltages[index] - adcValue;
|
const double valueDelta = this->rawAdcVoltages[index] - adcValue;
|
||||||
double voltage = this->startVoltage + (index - 1) * this->stepVoltage;
|
double voltage = this->startVoltage + (index - 1) * this->stepVoltage;
|
||||||
voltage += valueDelta / indexDelta * this->stepVoltage;
|
voltage += valueDelta / indexDelta * this->stepVoltage;
|
||||||
this->batteryVoltage = voltage;
|
this->batteryVoltage = voltage;
|
||||||
|
|
||||||
// std::cout << "Battery::calculateBatteryVoltage() - Voltage: " << voltage << " Index: " <<(int) index << " adcValue: " << (int) adcValue <<" iD: " << indexDelta << " vD: " << valueDelta << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battery::calculateBatteryPercent() {
|
void Battery::calculateBatteryPercent()
|
||||||
|
{
|
||||||
int8_t size = sizeof(this->capacityVoltages) / sizeof(*this->capacityVoltages);
|
int8_t size = sizeof(this->capacityVoltages) / sizeof(*this->capacityVoltages);
|
||||||
uint8_t i;
|
uint8_t index = 0;
|
||||||
for (i = 0; i < size; i++) {
|
for (; index < size; index++)
|
||||||
if (this->batteryVoltage <= this->capacityVoltages[i])
|
{
|
||||||
|
if (this->batteryVoltage <= this->capacityVoltages[index])
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == 0) {
|
|
||||||
if (this->batteryVoltage > 6)
|
|
||||||
std::cout << "Critical low battery!" << std::endl;
|
|
||||||
} else if (i == size - 1) {
|
|
||||||
|
|
||||||
} else {
|
if (index == 0)
|
||||||
double diffToLowerVal = this->batteryVoltage - this->capacityVoltages[i - 1];
|
{
|
||||||
double diffToHigherVal = this->capacityVoltages[i] - this->batteryVoltage;
|
if (this->batteryVoltage > this->absurdLowVoltage)
|
||||||
if (diffToLowerVal > diffToHigherVal)
|
{
|
||||||
i--;
|
std::cout << "Critical low battery!" << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this->batteryPercent = i * (100 / (size - 1));
|
else if (index == size - 1)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const double diffToLowerVal = this->batteryVoltage - this->capacityVoltages[index - 1];
|
||||||
|
const double diffToHigherVal = this->capacityVoltages[index] - this->batteryVoltage;
|
||||||
|
if (diffToLowerVal > diffToHigherVal)
|
||||||
|
{
|
||||||
|
index--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this->batteryPercent = index * (100 / (size - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battery::readAdcToBuf() {
|
void Battery::readAdcToBuf()
|
||||||
|
{
|
||||||
this->adcBuffer[this->bufferPos] = analogRead(this->pin);
|
this->adcBuffer[this->bufferPos] = analogRead(this->pin);
|
||||||
this->bufferPos++;
|
this->bufferPos++;
|
||||||
if (this->bufferPos == Battery::bufferSize)
|
if (this->bufferPos == Battery::bufferSize)
|
||||||
|
{
|
||||||
this->bufferPos = 0;
|
this->bufferPos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// std::cout << "Battery::readAdcToBuf added Value: " << this->adcBuffer[this->bufferPos] << std::endl;
|
// std::cout << "Battery::readAdcToBuf added Value: " << this->adcBuffer[this->bufferPos] << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Battery::initBuffer() {
|
void Battery::initBuffer()
|
||||||
|
{
|
||||||
for (uint8_t i = 0; i < Battery::bufferSize; i++)
|
for (uint8_t i = 0; i < Battery::bufferSize; i++)
|
||||||
|
{
|
||||||
this->adcBuffer[i] = 0;
|
this->adcBuffer[i] = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Battery::getBufAvg() const {
|
uint16_t Battery::getBufAvg() const
|
||||||
|
{
|
||||||
uint32_t res = 0;
|
uint32_t res = 0;
|
||||||
uint8_t emptyPos = 0;
|
uint8_t emptyPos = 0;
|
||||||
for (uint8_t i = 0; i < Battery::bufferSize; i++) {
|
for (uint8_t i = 0; i < Battery::bufferSize; i++)
|
||||||
|
{
|
||||||
if (this->adcBuffer[i] == 0)
|
if (this->adcBuffer[i] == 0)
|
||||||
|
{
|
||||||
emptyPos++;
|
emptyPos++;
|
||||||
|
}
|
||||||
res += this->adcBuffer[i];
|
res += this->adcBuffer[i];
|
||||||
}
|
}
|
||||||
return res / (Battery::bufferSize - emptyPos);
|
return res / (Battery::bufferSize - emptyPos);
|
||||||
|
|||||||
+106
-97
@@ -4,9 +4,9 @@
|
|||||||
* @brief Contains a class for battery monitoring
|
* @brief Contains a class for battery monitoring
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2022-02-05
|
* @date 2022-02-05
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2022
|
* @copyright Copyright (c) 2022
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef BATTERY_H
|
#ifndef BATTERY_H
|
||||||
@@ -21,118 +21,127 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A class for battery monitoring
|
* @brief A class for battery monitoring
|
||||||
*
|
*
|
||||||
* This class reads the voltage from an analog pin to calculate the
|
* This class reads the voltage from an analog pin to calculate the
|
||||||
* charge level of a 3 Cell Li-Poly battery pack. The battery pack have
|
* charge level of a 3 Cell Li-Poly battery pack. The battery pack have
|
||||||
* to be after a voltage diveder, so that maximum voltage for the
|
* to be after a voltage diveder, so that maximum voltage for the
|
||||||
* microcontroller is 3.3 Volt.
|
* microcontroller is 3.3 Volt.
|
||||||
*/
|
*/
|
||||||
class Battery : public Component {
|
class Battery : public Component
|
||||||
public:
|
{
|
||||||
enum CalibrationState {
|
public:
|
||||||
None,
|
enum CalibrationState
|
||||||
Reading,
|
{
|
||||||
Waiting,
|
None,
|
||||||
Finished
|
Reading,
|
||||||
};
|
Waiting,
|
||||||
|
Finished
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Construct a new Battery object
|
* @brief Construct a new Battery object
|
||||||
*
|
*
|
||||||
* The voltage devider have to be calculated, so that the input
|
* The voltage devider have to be calculated, so that the input
|
||||||
* voltage from 3.3 Volt is never exceeded. It is assumed that
|
* voltage from 3.3 Volt is never exceeded. It is assumed that
|
||||||
* the microcontroller is connected to the second resistor.
|
* the microcontroller is connected to the second resistor.
|
||||||
*
|
*
|
||||||
* @param pin The analog to read from.
|
* @param pin The analog to read from.
|
||||||
* @param r1 First resistor of the voltage devider.
|
* @param firstResistor First resistor of the voltage devider.
|
||||||
* @param r2 Second resistor of the voltage devider.
|
* @param secondResistor Second resistor of the voltage devider.
|
||||||
*/
|
*/
|
||||||
Battery(uint8_t pin, uint32_t r1, uint32_t r2);
|
Battery(uint8_t pin, uint32_t firstResistor, uint32_t secondResistor);
|
||||||
Battery(uint8_t pin);
|
Battery(uint8_t pin);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the battery voltage
|
* @brief Get the battery voltage
|
||||||
*
|
*
|
||||||
* @return double in Volt
|
* @return double in Volt
|
||||||
*/
|
*/
|
||||||
double getBatteryVoltage() const;
|
double getBatteryVoltage() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the charge level of the battery
|
* @brief Get the charge level of the battery
|
||||||
*
|
*
|
||||||
* @return uint8_t charge level in percent
|
* @return uint8_t charge level in percent
|
||||||
*/
|
*/
|
||||||
uint8_t getBatteryPercent() const { return this->batteryPercent; }
|
uint8_t getBatteryPercent() const { return this->batteryPercent; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Checks if the battery is low.
|
* @brief Checks if the battery is low.
|
||||||
*
|
*
|
||||||
* The function will also return false if the battery voltage is
|
* The function will also return false if the battery voltage is
|
||||||
* absurd low. This is for the case that the uController is powered
|
* absurd low. This is for the case that the uController is powered
|
||||||
* by usb and no battery is connected.
|
* by usb and no battery is connected.
|
||||||
*
|
*
|
||||||
* @param voltage the limit the battery have to
|
* @param voltage the limit the battery have to
|
||||||
* @return true if the battery is low
|
* @return true if the battery is low
|
||||||
* @return false if the battery is high
|
* @return false if the battery is high
|
||||||
*/
|
*/
|
||||||
bool isBatteryLow(double voltage) const;
|
bool isBatteryLow(double voltage) const;
|
||||||
|
|
||||||
bool isNewValue();
|
bool isNewValue();
|
||||||
|
|
||||||
//Calibration
|
// Calibration
|
||||||
CalibrationState getCalibrationState() const { return this->calibrationState; }
|
CalibrationState getCalibrationState() const { return this->calibrationState; }
|
||||||
uint8_t getCurrentCalibrationVoltage() const { return this->currentCalibrationVoltage; }
|
uint8_t getCurrentCalibrationVoltage() const { return this->currentCalibrationVoltage; }
|
||||||
void nextVoltageIsReady();
|
void nextVoltageIsReady();
|
||||||
void startCalibration();
|
void startCalibration();
|
||||||
void finishCalibration();
|
void finishCalibration();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void run() override;
|
void run() override;
|
||||||
void runCalibration();
|
void runCalibration();
|
||||||
double calculateInputVoltage();
|
double calculateInputVoltage();
|
||||||
void calculateBatteryVoltage();
|
void calculateBatteryVoltage();
|
||||||
void calculateBatteryPercent();
|
void calculateBatteryPercent();
|
||||||
void readAdcToBuf();
|
void readAdcToBuf();
|
||||||
void initBuffer();
|
void initBuffer();
|
||||||
uint16_t getBufAvg() const;
|
uint16_t getBufAvg() const;
|
||||||
|
|
||||||
static const uint8_t bufferSize = 30;
|
static constexpr uint8_t bufferSize = 30;
|
||||||
|
static constexpr uint8_t loopDelay = 100;
|
||||||
|
static constexpr uint16_t adcMaxValue = 4095;
|
||||||
|
|
||||||
CalibrationState calibrationState = CalibrationState::None;
|
CalibrationState calibrationState = CalibrationState::None;
|
||||||
|
|
||||||
uint8_t absurdLowVoltage = 5;
|
uint8_t absurdLowVoltage = 5;
|
||||||
uint8_t pin;
|
uint8_t pin;
|
||||||
uint8_t batteryPercent = 0;
|
uint8_t batteryPercent = 0;
|
||||||
uint8_t batteryLowPercent = 10;
|
uint8_t batteryLowPercent = 10;
|
||||||
uint8_t bufferPos = 0;
|
uint8_t bufferPos = 0;
|
||||||
uint8_t calulationDelayMultiplier = 5;
|
uint8_t calulationDelayMultiplier = 5;
|
||||||
uint8_t loopCounter = 0;
|
uint8_t loopCounter = 0;
|
||||||
uint8_t currentCalibrationVoltage = 0; // *0.1 + 7
|
uint8_t currentCalibrationVoltage = 0; // *0.1 + 7
|
||||||
uint16_t adcBuffer[bufferSize];
|
uint16_t adcBuffer[bufferSize];
|
||||||
uint16_t* newRawAdcVoltages;
|
uint16_t *newRawAdcVoltages = nullptr;
|
||||||
uint32_t r1 = 0;
|
uint32_t firstResistor = 0;
|
||||||
uint32_t r2 = 0;
|
uint32_t secondResistor = 0;
|
||||||
bool calculatetNewValues = false;
|
bool calculatetNewValues = false;
|
||||||
double batteryVoltage = 0;
|
double batteryVoltage = 0;
|
||||||
double batteryVoltageFactor;
|
double batteryVoltageFactor;
|
||||||
|
|
||||||
const float capacityVoltages[21] = {9.82, 10.83, 11.06, 11.12, // 0 5 10 15
|
const float capacityVoltages[21] = {9.82, 10.83, 11.06, 11.12, // 0 5 10 15
|
||||||
11.18, 11.24, 11.3, 11.36, // 20 25 30 35
|
11.18, 11.24, 11.3, 11.36, // 20 25 30 35
|
||||||
11.39, 11.45, 11.51, 11.56, // 40 45 50 55
|
11.39, 11.45, 11.51, 11.56, // 40 45 50 55
|
||||||
11.62, 11.74, 11.86, 11.95, // 60 65 70 75
|
11.62, 11.74, 11.86, 11.95, // 60 65 70 75
|
||||||
12.07, 12.25, 12.33, 12.45, // 80 85 90 95
|
12.07, 12.25, 12.33, 12.45, // 80 85 90 95
|
||||||
12.6 };
|
12.6};
|
||||||
|
|
||||||
const uint8_t rawAdcVoltagesCount = 60;
|
static constexpr uint8_t rawAdcVoltagesCount = 60;
|
||||||
const double startVoltage = 7;
|
const double startVoltage = 7;
|
||||||
const double stepVoltage = 0.1;
|
const double stepVoltage = 0.1;
|
||||||
const uint16_t rawAdcVoltages[60] = // from 7.0V to 12.9V in 0.1V steps
|
const uint16_t rawAdcVoltages[rawAdcVoltagesCount] = // from 7.0V to 12.9V in 0.1V steps
|
||||||
{1992, 2021, 2056, 2090, 2118, 2145, 2177, 2208, 2241, 2272,
|
{1992, 2021, 2056, 2090, 2118, 2145, 2177, 2208, 2241, 2272,
|
||||||
2298, 2331, 2362, 2387, 2420, 2453, 2482, 2514, 2543, 2577,
|
2298, 2331, 2362, 2387, 2420, 2453, 2482, 2514, 2543, 2577,
|
||||||
2607, 2640, 2670, 2703, 2736, 2763, 2794, 2826, 2858, 2890,
|
2607, 2640, 2670, 2703, 2736, 2763, 2794, 2826, 2858, 2890,
|
||||||
2920, 2956, 2983, 3019, 3054, 3088, 3121, 3158, 3189, 3226,
|
2920, 2956, 2983, 3019, 3054, 3088, 3121, 3158, 3189, 3226,
|
||||||
3264, 3300, 3339, 3379, 3414, 3453, 3500, 3544, 3598, 3636,
|
3264, 3300, 3339, 3379, 3414, 3453, 3500, 3544, 3598, 3636,
|
||||||
3682, 3730, 3781, 3837, 3887, 3943, 3997, 4054, 4093, 4095};
|
3682, 3730, 3781, 3837, 3887, 3943, 3997, 4054, 4093, 4095};
|
||||||
|
const double adcCurveCoeficient[5] = {0.000000000000016,
|
||||||
|
0.000000000118171,
|
||||||
|
0.000000301211691,
|
||||||
|
0.001109019271794,
|
||||||
|
0.034143524634089};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BATTERY_H
|
#endif // BATTERY_H
|
||||||
|
|||||||
@@ -1,114 +1,121 @@
|
|||||||
/**
|
/**
|
||||||
* @file calcAzimuth.cpp
|
* @file calcAzimuth.cpp
|
||||||
* @author Alexander Klein (alex@kleiax.de)
|
* @author Alexander Klein (alex@kleiax.de)
|
||||||
* @brief
|
* @brief
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2023-09-03
|
* @date 2023-09-03
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2023
|
* @copyright Copyright (c) 2023
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "calcAzimuth.h"
|
#include "calcAzimuth.h"
|
||||||
|
|
||||||
CalcAzimuth::CalcAzimuth(Point point) {
|
CalcAzimuth::CalcAzimuth(Point point)
|
||||||
this->lastChangePoint = point;
|
: lastChangePoint{point}, currentPosition{point}
|
||||||
this->currentPosition = point;
|
{
|
||||||
this->loopDelay = 50;
|
Component::loopDelay = CalcAzimuth::loopDelay;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalcAzimuth::drivingDirectionChange(Point point) {
|
void CalcAzimuth::drivingDirectionChange(Point point)
|
||||||
if (point.isInit() && point.isValid()) {
|
{
|
||||||
|
if (point.isInit() && point.isValid())
|
||||||
|
{
|
||||||
this->directionChangeMode = true;
|
this->directionChangeMode = true;
|
||||||
this->lastChangePoint = point;
|
this->lastChangePoint = point;
|
||||||
this->state = State::Invalid;
|
this->state = State::Invalid;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalcAzimuth::updateCurrentPosition(Point point) {
|
void CalcAzimuth::updateCurrentPosition(Point point)
|
||||||
|
{
|
||||||
this->currentPosition = point;
|
this->currentPosition = point;
|
||||||
this->positionChanged = true;
|
this->positionChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String CalcAzimuth::stateToString(State state) {
|
String CalcAzimuth::stateToString(State state)
|
||||||
switch (state) {
|
{
|
||||||
case State::Invalid:
|
switch (state)
|
||||||
return "Invalid";
|
{
|
||||||
|
case State::Invalid:
|
||||||
|
return "Invalid";
|
||||||
|
|
||||||
case State::Bad:
|
case State::Bad:
|
||||||
return "Bad";
|
return "Bad";
|
||||||
|
|
||||||
case State::Ok:
|
case State::Ok:
|
||||||
return "Ok";
|
return "Ok";
|
||||||
|
|
||||||
case State::Good:
|
case State::Good:
|
||||||
return "Good";
|
return "Good";
|
||||||
|
|
||||||
case State::Super:
|
case State::Super:
|
||||||
return "Super";
|
return "Super";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "UNKOWN";
|
return "UNKOWN";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalcAzimuth::run() {
|
void CalcAzimuth::run()
|
||||||
|
{
|
||||||
if (!this->positionChanged)
|
if (!this->positionChanged)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->positionChanged = false;
|
this->positionChanged = false;
|
||||||
this->updateAzimuth();
|
this->updateAzimuth();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalcAzimuth::updateAzimuth() {
|
void CalcAzimuth::updateAzimuth()
|
||||||
if (!this->directionChangeMode
|
{
|
||||||
|| this->lastChangePoint.distanceTo(this->currentPosition) < 1.0)
|
if (!this->directionChangeMode || this->lastChangePoint.distanceTo(this->currentPosition) < 1.0)
|
||||||
{
|
{
|
||||||
this->state = State::Invalid;
|
this->state = State::Invalid;
|
||||||
this->calcAzimuth = 999;
|
this->calcAzimuth = INT16_MIN;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->calcAzimuth = this->lastChangePoint.courseTo(this->currentPosition);
|
this->calcAzimuth = this->lastChangePoint.courseTo(this->currentPosition);
|
||||||
|
|
||||||
// Map point accuracy to State
|
// Map point accuracy to State
|
||||||
if (this->lastChangePoint.getAccuracy() == Point::Accuracy::oneDigOfCM
|
if (this->lastChangePoint.getAccuracy() == Point::Accuracy::oneDigOfCM || this->currentPosition.getAccuracy() == Point::Accuracy::oneDigOfCM)
|
||||||
|| this->currentPosition.getAccuracy() == Point::Accuracy::oneDigOfCM)
|
|
||||||
{
|
{
|
||||||
this->state = State::Good;
|
this->state = State::Good;
|
||||||
}
|
}
|
||||||
else if (this->lastChangePoint.getAccuracy() == Point::Accuracy::twoDigOfCM
|
else if (this->lastChangePoint.getAccuracy() == Point::Accuracy::twoDigOfCM || this->currentPosition.getAccuracy() == Point::Accuracy::twoDigOfCM)
|
||||||
|| this->currentPosition.getAccuracy() == Point::Accuracy::twoDigOfCM)
|
|
||||||
{
|
{
|
||||||
this->state = State::Ok;
|
this->state = State::Ok;
|
||||||
}
|
}
|
||||||
else if (this->lastChangePoint.getAccuracy() == Point::Accuracy::threeDigOfCM
|
else if (this->lastChangePoint.getAccuracy() == Point::Accuracy::threeDigOfCM || this->currentPosition.getAccuracy() == Point::Accuracy::threeDigOfCM)
|
||||||
|| this->currentPosition.getAccuracy() == Point::Accuracy::threeDigOfCM)
|
|
||||||
{
|
{
|
||||||
this->state = State::Bad;
|
this->state = State::Bad;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->state = State::Invalid;
|
this->state = State::Invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Upgrade quality if the range grows up
|
// Upgrade quality if the range grows up
|
||||||
if (this->lastChangePoint.distanceTo(this->currentPosition) > 2.0) {
|
if (this->lastChangePoint.distanceTo(this->currentPosition) > this->minDistanceForBetterQuality)
|
||||||
switch (this->state) {
|
{
|
||||||
case State::Bad :
|
switch (this->state)
|
||||||
this->state = State::Ok;
|
{
|
||||||
break;
|
case State::Bad:
|
||||||
|
this->state = State::Ok;
|
||||||
case State::Ok :
|
break;
|
||||||
this->state = State::Good;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case State::Good :
|
case State::Ok:
|
||||||
this->state = State::Super;
|
this->state = State::Good;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case State::Good:
|
||||||
break;
|
this->state = State::Super;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* @file calcAzimuth.h
|
* @file calcAzimuth.h
|
||||||
* @author Alexander Klein (alex@kleiax.de)
|
* @author Alexander Klein (alex@kleiax.de)
|
||||||
* @brief
|
* @brief
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2023-09-03
|
* @date 2023-09-03
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2023
|
* @copyright Copyright (c) 2023
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CALC_AZIMUTH_H
|
#ifndef CALC_AZIMUTH_H
|
||||||
@@ -15,38 +15,43 @@
|
|||||||
#include "component.h"
|
#include "component.h"
|
||||||
#include "point.h"
|
#include "point.h"
|
||||||
|
|
||||||
class CalcAzimuth : public Component {
|
class CalcAzimuth : public Component
|
||||||
public:
|
{
|
||||||
enum State {
|
public:
|
||||||
Invalid,
|
enum State
|
||||||
Bad,
|
{
|
||||||
Ok,
|
Invalid,
|
||||||
Good,
|
Bad,
|
||||||
Super
|
Ok,
|
||||||
};
|
Good,
|
||||||
|
Super
|
||||||
|
};
|
||||||
|
|
||||||
CalcAzimuth(Point point);
|
CalcAzimuth(Point point);
|
||||||
|
|
||||||
void drivingDirectionChange(Point point);
|
void drivingDirectionChange(Point point);
|
||||||
void updateCurrentPosition(Point point);
|
void updateCurrentPosition(Point point);
|
||||||
void disableCalcAzimuth() { this->directionChangeMode = false; }
|
void disableCalcAzimuth() { this->directionChangeMode = false; }
|
||||||
|
|
||||||
int16_t getAzimuth() const { return this->calcAzimuth; }
|
int16_t getAzimuth() const { return this->calcAzimuth; }
|
||||||
State getState() const { return this->state; }
|
State getState() const { return this->state; }
|
||||||
|
|
||||||
static String stateToString(State state);
|
static String stateToString(State state);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void run() override;
|
void run() override;
|
||||||
void updateAzimuth();
|
void updateAzimuth();
|
||||||
|
|
||||||
State state = State::Invalid;
|
State state = State::Invalid;
|
||||||
Point lastChangePoint;
|
Point lastChangePoint;
|
||||||
Point currentPosition;
|
Point currentPosition;
|
||||||
|
|
||||||
bool positionChanged = false;
|
bool positionChanged = false;
|
||||||
bool directionChangeMode = false;
|
bool directionChangeMode = false;
|
||||||
int16_t calcAzimuth = INT16_MAX;
|
int16_t calcAzimuth = INT16_MAX;
|
||||||
|
double minDistanceForBetterQuality = 2;
|
||||||
|
|
||||||
|
static constexpr uint8_t loopDelay = 50;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //CALC_AZIMUTH_H
|
#endif // CALC_AZIMUTH_H
|
||||||
|
|||||||
@@ -1,25 +1,35 @@
|
|||||||
#include "component.h"
|
#include "component.h"
|
||||||
|
|
||||||
Component::Component(uint16_t loopDelay) {
|
Component::Component(uint16_t loopDelay) : loopDelay{loopDelay}
|
||||||
this->loopDelay = loopDelay;
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Component::loop() {
|
void Component::loop()
|
||||||
|
{
|
||||||
if (!this->active)
|
if (!this->active)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this->childComponents.size()){
|
if (this->childComponents.size())
|
||||||
std::list<Component*>::iterator it;
|
{
|
||||||
|
std::list<Component *>::iterator it;
|
||||||
for (it = this->childComponents.begin(); it != this->childComponents.end(); it++)
|
for (it = this->childComponents.begin(); it != this->childComponents.end(); it++)
|
||||||
|
{
|
||||||
(*it)->loop();
|
(*it)->loop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this->runAsChild();
|
this->runAsChild();
|
||||||
|
|
||||||
if (this->onlyChilds)
|
if (this->onlyChilds)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this->loopDelay && millis() - this->lastMillis < this->loopDelay)
|
if (static_cast<bool>(this->loopDelay) && millis() - this->lastMillis < this->loopDelay)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->lastMillis = millis();
|
this->lastMillis = millis();
|
||||||
|
|
||||||
@@ -28,13 +38,17 @@ void Component::loop() {
|
|||||||
this->afterRun();
|
this->afterRun();
|
||||||
|
|
||||||
if (this->timeUpdateAfter)
|
if (this->timeUpdateAfter)
|
||||||
|
{
|
||||||
this->lastMillis = millis();
|
this->lastMillis = millis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Component::addChildComponent(Component* child) {
|
void Component::addChildComponent(Component *child)
|
||||||
|
{
|
||||||
this->childComponents.push_back(child);
|
this->childComponents.push_back(child);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Component::removeChildComponent(Component* child) {
|
void Component::removeChildComponent(Component *child)
|
||||||
|
{
|
||||||
this->childComponents.remove(child);
|
this->childComponents.remove(child);
|
||||||
}
|
}
|
||||||
|
|||||||
+30
-29
@@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* @file component.h
|
* @file component.h
|
||||||
* @author Alexander Klein (alex@kleiax.de)
|
* @author Alexander Klein (alex@kleiax.de)
|
||||||
* @brief
|
* @brief
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2023-08-16
|
* @date 2023-08-16
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2023
|
* @copyright Copyright (c) 2023
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@@ -15,37 +15,38 @@
|
|||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
|
||||||
class Component {
|
class Component
|
||||||
public:
|
{
|
||||||
Component() {}
|
public:
|
||||||
Component(uint16_t loopDelay);
|
Component() {}
|
||||||
|
Component(uint16_t loopDelay);
|
||||||
|
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
void deactivate() { this->active = false; }
|
|
||||||
void activate() { this->active = false; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual void runAsChild() {}
|
|
||||||
virtual void beforeRun() {}
|
|
||||||
virtual void run() = 0;
|
|
||||||
virtual void afterRun() {}
|
|
||||||
|
|
||||||
void addChildComponent(Component* child);
|
void deactivate() { this->active = false; }
|
||||||
void removeChildComponent(Component* child);
|
void activate() { this->active = false; }
|
||||||
|
|
||||||
void activateOnlyChilds() { this->onlyChilds = true; }
|
protected:
|
||||||
void deactivateOnlyChilds() { this->onlyChilds = false; }
|
virtual void runAsChild() {}
|
||||||
|
virtual void beforeRun() {}
|
||||||
|
virtual void run() = 0;
|
||||||
|
virtual void afterRun() {}
|
||||||
|
|
||||||
void setTimerAfterTask() { this->timeUpdateAfter = true; }
|
void addChildComponent(Component *child);
|
||||||
|
void removeChildComponent(Component *child);
|
||||||
|
|
||||||
uint16_t loopDelay = 0;
|
void activateOnlyChilds() { this->onlyChilds = true; }
|
||||||
|
void deactivateOnlyChilds() { this->onlyChilds = false; }
|
||||||
|
|
||||||
private:
|
void setTimerAfterTask() { this->timeUpdateAfter = true; }
|
||||||
std::list<Component*> childComponents;
|
|
||||||
|
|
||||||
bool active = true;
|
uint16_t loopDelay = 0;
|
||||||
bool onlyChilds = false;
|
|
||||||
bool timeUpdateAfter = false;
|
private:
|
||||||
uint32_t lastMillis = 0;
|
std::list<Component *> childComponents;
|
||||||
|
|
||||||
|
bool active = true;
|
||||||
|
bool onlyChilds = false;
|
||||||
|
bool timeUpdateAfter = false;
|
||||||
|
uint32_t lastMillis = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,37 +1,43 @@
|
|||||||
/**
|
/**
|
||||||
* @file controlPad.cpp
|
* @file controlPad.cpp
|
||||||
* @author Alexander Klein (alex@kleiax.de)
|
* @author Alexander Klein (alex@kleiax.de)
|
||||||
* @brief
|
* @brief
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2023-03-30
|
* @date 2023-03-30
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2023
|
* @copyright Copyright (c) 2023
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "controlPad.h"
|
#include "controlPad.h"
|
||||||
|
|
||||||
ControlPad::ControlPad() {
|
ControlPad::ControlPad() : Component(5), controlInput{0, 0, 0, 0} {}
|
||||||
this->loopDelay = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ControlPad::run() {
|
void ControlPad::run()
|
||||||
if(!this->connected)
|
{
|
||||||
|
if (!this->connected)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (millis() - this->lastMessageReceive > this->disconnectTime) {
|
if (millis() - this->lastMessageReceive > this->disconnectTime)
|
||||||
|
{
|
||||||
this->connected = false;
|
this->connected = false;
|
||||||
this->controlInput.buttons = 0;
|
this->controlInput.buttons = 0;
|
||||||
this->controlInput.x = 127;
|
this->controlInput.x = UINT8_MAX / 2;
|
||||||
this->controlInput.y = 127;
|
this->controlInput.y = UINT8_MAX / 2;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->lastButtons != controlInput.buttons)
|
if (this->lastButtons != controlInput.buttons)
|
||||||
|
{
|
||||||
this->updated = true;
|
this->updated = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (this->menuControl && this->controlInput.buttons > 0 && this->updated) {
|
if (static_cast<bool>(this->menuControl) && this->controlInput.buttons > 0 && this->updated)
|
||||||
if (this->firstButtonPress) {
|
{
|
||||||
|
if (this->firstButtonPress)
|
||||||
|
{
|
||||||
this->menuControl->printMenu();
|
this->menuControl->printMenu();
|
||||||
this->firstButtonPress = false;
|
this->firstButtonPress = false;
|
||||||
std::cout << "ControlPad::loop - First menu print" << std::endl;
|
std::cout << "ControlPad::loop - First menu print" << std::endl;
|
||||||
@@ -39,38 +45,48 @@ void ControlPad::run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Left))
|
if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Left))
|
||||||
|
{
|
||||||
this->menuControl->left();
|
this->menuControl->left();
|
||||||
|
}
|
||||||
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Right))
|
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Right))
|
||||||
|
{
|
||||||
this->menuControl->right();
|
this->menuControl->right();
|
||||||
|
}
|
||||||
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Up))
|
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Up))
|
||||||
|
{
|
||||||
this->menuControl->up();
|
this->menuControl->up();
|
||||||
|
}
|
||||||
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Down))
|
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Down))
|
||||||
|
{
|
||||||
this->menuControl->down();
|
this->menuControl->down();
|
||||||
|
}
|
||||||
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Yes))
|
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Yes))
|
||||||
|
{
|
||||||
this->menuControl->yes();
|
this->menuControl->yes();
|
||||||
|
}
|
||||||
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::No))
|
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::No))
|
||||||
|
{
|
||||||
this->menuControl->no();
|
this->menuControl->no();
|
||||||
|
}
|
||||||
|
|
||||||
this->updated = false;
|
this->updated = false;
|
||||||
this->lastButtons = controlInput.buttons;
|
this->lastButtons = controlInput.buttons;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlPad::insertData(const uint8_t *data) {
|
void ControlPad::insertData(const uint8_t *data)
|
||||||
|
{
|
||||||
this->connected = true;
|
this->connected = true;
|
||||||
this->lastMessageReceive = millis();
|
this->lastMessageReceive = millis();
|
||||||
|
|
||||||
uint8_t lastCount = this->controlInput.counter + 1;
|
const uint8_t lastCount = this->controlInput.counter + 1;
|
||||||
memcpy(&(this->controlInput), data, sizeof(this->controlInput));
|
memcpy(&(this->controlInput), data, sizeof(this->controlInput));
|
||||||
if (lastCount != this->controlInput.counter)
|
if (lastCount != this->controlInput.counter)
|
||||||
std::cout << "ControlPad::insertData counter wrong value" << std::endl;
|
std::cout << "ControlPad::insertData counter wrong value" << std::endl;
|
||||||
|
|
||||||
if (this->controlInput.x > 127 - this->deadZoneX
|
if (this->controlInput.x > UINT8_MAX / 2 - this->deadZoneX && this->controlInput.x < UINT8_MAX / 2 + this->deadZoneX)
|
||||||
&& this->controlInput.x < 127 + this->deadZoneX)
|
this->controlInput.x = UINT8_MAX / 2;
|
||||||
this->controlInput.x = 127;
|
|
||||||
|
|
||||||
if (this->controlInput.y > 127 - this->deadZoneY
|
if (this->controlInput.y > UINT8_MAX / 2 - this->deadZoneY && this->controlInput.y < UINT8_MAX / 2 + this->deadZoneY)
|
||||||
&& this->controlInput.y < 127 + this->deadZoneY)
|
this->controlInput.y = UINT8_MAX / 2;
|
||||||
this->controlInput.y = 127;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* @file controlPad.h
|
* @file controlPad.h
|
||||||
* @author Alexander Klein (alex@kleiax.de)
|
* @author Alexander Klein (alex@kleiax.de)
|
||||||
* @brief
|
* @brief
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2023-03-30
|
* @date 2023-03-30
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2023
|
* @copyright Copyright (c) 2023
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@@ -16,33 +16,34 @@
|
|||||||
#include <controlPadInput.h>
|
#include <controlPadInput.h>
|
||||||
#include <component.h>
|
#include <component.h>
|
||||||
|
|
||||||
class ControlPad : public Component {
|
class ControlPad : public Component
|
||||||
public:
|
{
|
||||||
ControlPad();
|
public:
|
||||||
|
ControlPad();
|
||||||
|
|
||||||
void insertData(const uint8_t *data);
|
void insertData(const uint8_t *data);
|
||||||
|
|
||||||
void setMenuControl(MenuControl* menuControl) { this->menuControl = menuControl; }
|
void setMenuControl(MenuControl *menuControl) { this->menuControl = menuControl; }
|
||||||
|
|
||||||
const ControlPadInput* getControlPadDataPtr() const { return &this->controlInput; }
|
const ControlPadInput *getControlPadDataPtr() const { return &this->controlInput; }
|
||||||
|
|
||||||
bool isControlPadConnected() const { return this->connected; }
|
bool isControlPadConnected() const { return this->connected; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void run() override;
|
void run() override;
|
||||||
|
|
||||||
MenuControl* menuControl = nullptr;
|
MenuControl *menuControl = nullptr;
|
||||||
ControlPadInput controlInput;
|
ControlPadInput controlInput;
|
||||||
|
|
||||||
bool connected = false;
|
bool connected = false;
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
bool firstButtonPress = true;
|
bool firstButtonPress = true;
|
||||||
|
|
||||||
uint8_t deadZoneX = 20;
|
uint8_t deadZoneX = 20;
|
||||||
uint8_t deadZoneY = 20;
|
uint8_t deadZoneY = 20;
|
||||||
uint8_t lastButtons = 0;
|
uint8_t lastButtons = 0;
|
||||||
|
|
||||||
uint16_t disconnectTime = 100;
|
uint16_t disconnectTime = 100;
|
||||||
|
|
||||||
uint32_t lastMessageReceive = 0;
|
uint32_t lastMessageReceive = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* @file controlPadInput.h
|
* @file controlPadInput.h
|
||||||
* @author Alexander Klein (alex@kleiax.de)
|
* @author Alexander Klein (alex@kleiax.de)
|
||||||
* @brief
|
* @brief
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2023-03-30
|
* @date 2023-03-30
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2023
|
* @copyright Copyright (c) 2023
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONTROL_PAD_INPUT_H
|
#ifndef CONTROL_PAD_INPUT_H
|
||||||
@@ -14,61 +14,66 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
struct ControlPadInput {
|
struct ControlPadInput
|
||||||
|
{
|
||||||
uint8_t buttons;
|
uint8_t buttons;
|
||||||
uint8_t x;
|
uint8_t x;
|
||||||
uint8_t y;
|
uint8_t y;
|
||||||
uint8_t counter;
|
uint8_t counter;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ControlPadButton
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum PadButton
|
||||||
|
{
|
||||||
|
Left = 4,
|
||||||
|
Right = 8,
|
||||||
|
Up = 2,
|
||||||
|
Down = 1,
|
||||||
|
Yes = 32,
|
||||||
|
No = 16,
|
||||||
|
Action = 64
|
||||||
|
};
|
||||||
|
|
||||||
class ControlPadButton {
|
static bool isControlPadButtonPressed(const ControlPadInput *input, PadButton button)
|
||||||
public:
|
{
|
||||||
enum PadButton {
|
uint8_t buttonNum = input->buttons;
|
||||||
Left = 4,
|
switch (button)
|
||||||
Right = 8,
|
{
|
||||||
Up = 2,
|
case PadButton::Left:
|
||||||
Down = 1,
|
return buttonNum & (uint8_t)PadButton::Left;
|
||||||
Yes = 32,
|
break;
|
||||||
No = 16,
|
|
||||||
Action = 64
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool isControlPadButtonPressed(const ControlPadInput *input, PadButton button) {
|
case PadButton::Right:
|
||||||
uint8_t buttonNum = input->buttons;
|
return buttonNum & (uint8_t)PadButton::Right;
|
||||||
switch (button) {
|
break;
|
||||||
case PadButton::Left :
|
|
||||||
return buttonNum & (uint8_t) PadButton::Left;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PadButton::Right :
|
case PadButton::Up:
|
||||||
return buttonNum & (uint8_t) PadButton::Right;
|
return buttonNum & (uint8_t)PadButton::Up;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PadButton::Up :
|
case PadButton::Down:
|
||||||
return buttonNum & (uint8_t) PadButton::Up;
|
return buttonNum & (uint8_t)PadButton::Down;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PadButton::Down :
|
case PadButton::Yes:
|
||||||
return buttonNum & (uint8_t) PadButton::Down;
|
return buttonNum & (uint8_t)PadButton::Yes;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PadButton::Yes :
|
case PadButton::No:
|
||||||
return buttonNum & (uint8_t) PadButton::Yes;
|
return buttonNum & (uint8_t)PadButton::No;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PadButton::No :
|
case PadButton::Action:
|
||||||
return buttonNum & (uint8_t) PadButton::No;
|
return buttonNum & (uint8_t)PadButton::Action;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PadButton::Action :
|
default:
|
||||||
return buttonNum & (uint8_t) PadButton::Action;
|
return false;
|
||||||
break;
|
;
|
||||||
|
|
||||||
default:
|
|
||||||
return false;;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CONTROL_PAD_INPUT_H
|
#endif // CONTROL_PAD_INPUT_H
|
||||||
|
|||||||
+21
-14
@@ -1,14 +1,14 @@
|
|||||||
#include "counter.h"
|
#include "counter.h"
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
uint8_t Counter::amountOfCounter = 0;
|
uint8_t Counter::amountOfCounter = 0;
|
||||||
|
|
||||||
Counter::Counter(uint8_t pin) {
|
Counter::Counter(uint8_t pin)
|
||||||
this->pulsePin = pin;
|
: pulsePin{pin}, unit{static_cast<pcnt_unit_t>(Counter::amountOfCounter)}
|
||||||
|
{
|
||||||
this->unit = static_cast<pcnt_unit_t>(Counter::amountOfCounter);
|
if (Counter::amountOfCounter <= Counter::maxCounter)
|
||||||
if (Counter::amountOfCounter < 7)
|
{
|
||||||
Counter::amountOfCounter++;
|
Counter::amountOfCounter++;
|
||||||
|
}
|
||||||
|
|
||||||
pcnt_config_t config;
|
pcnt_config_t config;
|
||||||
config.unit = this->unit;
|
config.unit = this->unit;
|
||||||
@@ -24,33 +24,40 @@ Counter::Counter(uint8_t pin) {
|
|||||||
pcnt_unit_config(&config);
|
pcnt_unit_config(&config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Counter::pause() {
|
void Counter::pause()
|
||||||
|
{
|
||||||
pcnt_counter_pause(this->unit);
|
pcnt_counter_pause(this->unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Counter::resume() {
|
void Counter::resume()
|
||||||
|
{
|
||||||
pcnt_counter_resume(this->unit);
|
pcnt_counter_resume(this->unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Counter::clear() {
|
void Counter::clear()
|
||||||
|
{
|
||||||
pcnt_counter_clear(this->unit);
|
pcnt_counter_clear(this->unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
int16_t Counter::getValue() const {
|
int16_t Counter::getValue() const
|
||||||
int16_t res;
|
{
|
||||||
|
int16_t res = 0;
|
||||||
pcnt_get_counter_value(this->unit, &res);
|
pcnt_get_counter_value(this->unit, &res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Counter::setFilterValue(uint16_t value) {
|
void Counter::setFilterValue(uint16_t value)
|
||||||
|
{
|
||||||
pcnt_set_filter_value(this->unit, value);
|
pcnt_set_filter_value(this->unit, value);
|
||||||
this->filterEnable();
|
this->filterEnable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Counter::filterEnable() {
|
void Counter::filterEnable()
|
||||||
|
{
|
||||||
pcnt_filter_enable(this->unit);
|
pcnt_filter_enable(this->unit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Counter::filterDisable() {
|
void Counter::filterDisable()
|
||||||
|
{
|
||||||
pcnt_filter_disable(this->unit);
|
pcnt_filter_disable(this->unit);
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-17
@@ -2,29 +2,32 @@
|
|||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <driver/pcnt.h>
|
#include <driver/pcnt.h>
|
||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
class Counter {
|
class Counter
|
||||||
public:
|
{
|
||||||
Counter(uint8_t pin);
|
public:
|
||||||
|
Counter(uint8_t pin);
|
||||||
|
|
||||||
void pause();
|
void pause();
|
||||||
void resume();
|
void resume();
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
int16_t getValue() const;
|
int16_t getValue() const;
|
||||||
|
|
||||||
void setFilterValue(uint16_t value);
|
void setFilterValue(uint16_t value);
|
||||||
void filterEnable();
|
void filterEnable();
|
||||||
void filterDisable();
|
void filterDisable();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr int16_t highLimit = INT16_MAX;
|
static constexpr int16_t highLimit = INT16_MAX;
|
||||||
static constexpr uint8_t lowLimit = 0;
|
static constexpr uint8_t lowLimit = 0;
|
||||||
|
static constexpr uint8_t maxCounter = 6;
|
||||||
|
|
||||||
static uint8_t amountOfCounter;
|
static uint8_t amountOfCounter;
|
||||||
|
|
||||||
bool initalised = false;
|
bool initalised = false;
|
||||||
|
|
||||||
uint8_t pulsePin;
|
uint8_t pulsePin;
|
||||||
pcnt_unit_t unit;
|
pcnt_unit_t unit;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,62 +4,80 @@
|
|||||||
* @brief Contains the implementation of the class LcdWrapper
|
* @brief Contains the implementation of the class LcdWrapper
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2023-01-08
|
* @date 2023-01-08
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2023
|
* @copyright Copyright (c) 2023
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "LcdWrapper.h"
|
#include "LcdWrapper.h"
|
||||||
|
|
||||||
LcdWrapper::LcdWrapper(LiquidCrystal_I2C* lcd) {
|
LcdWrapper::LcdWrapper(LiquidCrystal_I2C *lcd)
|
||||||
this->lcd = lcd;
|
: lcd{lcd}, changed{false}
|
||||||
|
{
|
||||||
this->clear();
|
this->clear();
|
||||||
this->changed = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LcdWrapper::run() {
|
void LcdWrapper::run()
|
||||||
|
{
|
||||||
if (!this->changed)
|
if (!this->changed)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->lcd->clear();
|
this->lcd->clear();
|
||||||
for (uint8_t i = 0; i < LcdWrapper::totalLines; i++) {
|
for (uint8_t i = 0; i < LcdWrapper::totalLines; i++)
|
||||||
|
{
|
||||||
this->lcd->setCursor(0, i);
|
this->lcd->setCursor(0, i);
|
||||||
this->lcd->print(this->data[i]);
|
this->lcd->print(static_cast<const char *>(this->data[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->callback)
|
if (static_cast<bool>(this->callback))
|
||||||
|
{
|
||||||
this->callback(this->data, LcdWrapper::totalLines, LcdWrapper::totalRows);
|
this->callback(this->data, LcdWrapper::totalLines, LcdWrapper::totalRows);
|
||||||
|
}
|
||||||
|
|
||||||
this->changed = false;
|
this->changed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LcdWrapper::clear() {
|
void LcdWrapper::clear()
|
||||||
for (uint8_t i = 0; i < LcdWrapper::totalLines; i++) {
|
{
|
||||||
for (uint8_t j = 0; j < LcdWrapper::totalRows; j++) {
|
for (uint8_t i = 0; i < LcdWrapper::totalLines; i++)
|
||||||
|
{
|
||||||
|
for (uint8_t j = 0; j < LcdWrapper::totalRows; j++)
|
||||||
|
{
|
||||||
data[i][j] = ' ';
|
data[i][j] = ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->changed = true;
|
this->changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LcdWrapper::setCursor(uint8_t row, uint8_t line) {
|
void LcdWrapper::setCursor(uint8_t row, uint8_t line)
|
||||||
|
{
|
||||||
if (row > LcdWrapper::totalRows - 1)
|
if (row > LcdWrapper::totalRows - 1)
|
||||||
|
{
|
||||||
row = LcdWrapper::totalRows - 1;
|
row = LcdWrapper::totalRows - 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (line > LcdWrapper::totalLines - 1)
|
if (line > LcdWrapper::totalLines - 1)
|
||||||
|
{
|
||||||
line = LcdWrapper::totalLines - 1;
|
line = LcdWrapper::totalLines - 1;
|
||||||
|
}
|
||||||
|
|
||||||
this->cursorRow = row;
|
this->cursorRow = row;
|
||||||
this->cursorLine = line;
|
this->cursorLine = line;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LcdWrapper::print(const char *str) {
|
void LcdWrapper::print(const char *str)
|
||||||
|
{
|
||||||
uint8_t inputStringPosition = 0;
|
uint8_t inputStringPosition = 0;
|
||||||
for (uint8_t i = this->cursorRow; i < LcdWrapper::totalRows; i++) {
|
for (uint8_t i = this->cursorRow; i < LcdWrapper::totalRows; i++)
|
||||||
|
{
|
||||||
if (str[inputStringPosition] == '\0')
|
if (str[inputStringPosition] == '\0')
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
else
|
}
|
||||||
this->data[this->cursorLine][i] = str[inputStringPosition];
|
this->data[this->cursorLine][i] = str[inputStringPosition];
|
||||||
|
|
||||||
inputStringPosition++;
|
inputStringPosition++;
|
||||||
}
|
}
|
||||||
this->changed = true;
|
this->changed = true;
|
||||||
|
|||||||
+45
-44
@@ -4,9 +4,9 @@
|
|||||||
* @brief Contains the LcdWrapper class
|
* @brief Contains the LcdWrapper class
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2023-01-08
|
* @date 2023-01-08
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2023
|
* @copyright Copyright (c) 2023
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LCD_WRAPPER_H
|
#ifndef LCD_WRAPPER_H
|
||||||
@@ -17,59 +17,60 @@
|
|||||||
#include <displayWrapper.h>
|
#include <displayWrapper.h>
|
||||||
#include <component.h>
|
#include <component.h>
|
||||||
|
|
||||||
typedef void (*LcdWrapperCallback) (const char data[][16], uint8_t lines, uint8_t rows);
|
typedef void (*LcdWrapperCallback)(const char data[][16], uint8_t lines, uint8_t rows);
|
||||||
/**
|
/**
|
||||||
* @brief A class for the Menu class to print information
|
* @brief A class for the Menu class to print information
|
||||||
*
|
*
|
||||||
* This class inherits the DisplayWrapper class as a interface.
|
* This class inherits the DisplayWrapper class as a interface.
|
||||||
* The class takes the information to print from any thread. The
|
* The class takes the information to print from any thread. The
|
||||||
* loop function has to be called to print the data.
|
* loop function has to be called to print the data.
|
||||||
*/
|
*/
|
||||||
class LcdWrapper : public DisplayWrapper, public Component {
|
class LcdWrapper : public DisplayWrapper, public Component
|
||||||
public:
|
{
|
||||||
/**
|
public:
|
||||||
* @brief Construct a new Lcd Wrapper object
|
/**
|
||||||
*
|
* @brief Construct a new Lcd Wrapper object
|
||||||
* @param lcd
|
*
|
||||||
*/
|
* @param lcd
|
||||||
LcdWrapper(LiquidCrystal_I2C* lcd);
|
*/
|
||||||
|
LcdWrapper(LiquidCrystal_I2C *lcd);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Empty the buffer
|
* @brief Empty the buffer
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void clear() override;
|
void clear() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set point where data to be saved
|
* @brief Set point where data to be saved
|
||||||
*
|
*
|
||||||
* @param row
|
* @param row
|
||||||
* @param line
|
* @param line
|
||||||
*/
|
*/
|
||||||
void setCursor(uint8_t row, uint8_t line) override;
|
void setCursor(uint8_t row, uint8_t line) override;
|
||||||
void setCallback(LcdWrapperCallback callback) { this->callback = callback; }
|
void setCallback(LcdWrapperCallback callback) { this->callback = callback; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Save the data to be printed
|
* @brief Save the data to be printed
|
||||||
*
|
*
|
||||||
* @param str
|
* @param str
|
||||||
*/
|
*/
|
||||||
void print(const char *str) override;
|
void print(const char *str) override;
|
||||||
|
|
||||||
static constexpr uint8_t totalRows = 16;
|
static constexpr uint8_t totalRows = 16;
|
||||||
static constexpr uint8_t totalLines = 2;
|
static constexpr uint8_t totalLines = 2;
|
||||||
private:
|
|
||||||
void run() override;
|
|
||||||
|
|
||||||
|
private:
|
||||||
LiquidCrystal_I2C* lcd;
|
void run() override;
|
||||||
LcdWrapperCallback callback = nullptr;
|
|
||||||
char data[LcdWrapper::totalLines][LcdWrapper::totalRows];
|
|
||||||
|
|
||||||
uint8_t cursorRow = 0;
|
LiquidCrystal_I2C *lcd;
|
||||||
uint8_t cursorLine = 0;
|
LcdWrapperCallback callback = nullptr;
|
||||||
|
char data[LcdWrapper::totalLines][LcdWrapper::totalRows];
|
||||||
|
|
||||||
bool changed = false;
|
uint8_t cursorRow = 0;
|
||||||
|
uint8_t cursorLine = 0;
|
||||||
|
|
||||||
|
bool changed = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DISPLAY_WRAPPER_H
|
#endif // DISPLAY_WRAPPER_H
|
||||||
|
|||||||
@@ -1,68 +1,79 @@
|
|||||||
/**
|
/**
|
||||||
* @file calibrateCompass.cpp
|
* @file calibrateCompass.cpp
|
||||||
* @author Alexander Klein (alex@kleiax.de)
|
* @author Alexander Klein (alex@kleiax.de)
|
||||||
* @brief
|
* @brief
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2023-05-23
|
* @date 2023-05-23
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2023
|
* @copyright Copyright (c) 2023
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "calibrateCompass.h"
|
#include "calibrateCompass.h"
|
||||||
|
|
||||||
CalibrateCompass::CalibrateCompass(QMC5883LCompass* compass) {
|
CalibrateCompass::CalibrateCompass(QMC5883LCompass *compass)
|
||||||
|
{
|
||||||
this->compass = compass;
|
this->compass = compass;
|
||||||
this->state = State::Ready;
|
this->state = State::Ready;
|
||||||
this->clearData();
|
this->clearData();
|
||||||
this->activateOnlyChilds();
|
this->activateOnlyChilds();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrateCompass::runAsChild() {
|
void CalibrateCompass::runAsChild()
|
||||||
|
{
|
||||||
if (this->state != State::Calibrating)
|
if (this->state != State::Calibrating)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
|
||||||
this->compass->read();
|
this->compass->read();
|
||||||
int x = this->compass->getX();
|
int xAxis = this->compass->getX();
|
||||||
int y = this->compass->getY();
|
int yAxis = this->compass->getY();
|
||||||
int z = this->compass->getZ();
|
int zAxis = this->compass->getZ();
|
||||||
|
|
||||||
if(x < this->data.data[0][0]) {
|
if (xAxis < this->data.data[0][0])
|
||||||
this->data.data[0][0] = x;
|
{
|
||||||
|
this->data.data[0][0] = xAxis;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(x > this->data.data[0][1]) {
|
if (xAxis > this->data.data[0][1])
|
||||||
this->data.data[0][1] = x;
|
{
|
||||||
|
this->data.data[0][1] = xAxis;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(y < this->data.data[1][0]) {
|
if (yAxis < this->data.data[1][0])
|
||||||
this->data.data[1][0] = y;
|
{
|
||||||
|
this->data.data[1][0] = yAxis;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(y > this->data.data[1][1]) {
|
if (yAxis > this->data.data[1][1])
|
||||||
this->data.data[1][1] = y;
|
{
|
||||||
|
this->data.data[1][1] = yAxis;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(z < this->data.data[2][0]) {
|
if (zAxis < this->data.data[2][0])
|
||||||
this->data.data[2][0] = z;
|
{
|
||||||
|
this->data.data[2][0] = zAxis;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(z > this->data.data[2][1]) {
|
if (zAxis > this->data.data[2][1])
|
||||||
this->data.data[2][1] = z;
|
{
|
||||||
|
this->data.data[2][1] = zAxis;
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
this->lastChange = millis();
|
this->lastChange = millis();
|
||||||
|
|
||||||
if (millis() - this->lastChange > this->maxTimeWithoutChange) {
|
if (millis() - this->lastChange > this->maxTimeWithoutChange)
|
||||||
|
{
|
||||||
this->state = State::Finished;
|
this->state = State::Finished;
|
||||||
this->checkDataValidity();
|
this->checkDataValidity();
|
||||||
}
|
}
|
||||||
@@ -70,9 +81,12 @@ void CalibrateCompass::runAsChild() {
|
|||||||
|
|
||||||
void CalibrateCompass::run() {}
|
void CalibrateCompass::run() {}
|
||||||
|
|
||||||
void CalibrateCompass::start() {
|
void CalibrateCompass::start()
|
||||||
|
{
|
||||||
if (this->state != State::Ready)
|
if (this->state != State::Ready)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->clearData();
|
this->clearData();
|
||||||
this->state = State::Calibrating;
|
this->state = State::Calibrating;
|
||||||
@@ -80,39 +94,45 @@ void CalibrateCompass::start() {
|
|||||||
this->lastChange = millis();
|
this->lastChange = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrateCompass::useData() {
|
void CalibrateCompass::useData()
|
||||||
if (!this->dataValid) {
|
{
|
||||||
|
if (!this->dataValid)
|
||||||
|
{
|
||||||
std::cout << "CalibrateCompass::useData - Data not valid" << std::endl;
|
std::cout << "CalibrateCompass::useData - Data not valid" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->compass->setCalibration( this->data.data[0][0],
|
this->compass->setCalibration(this->data.data[0][0],
|
||||||
this->data.data[0][1],
|
this->data.data[0][1],
|
||||||
this->data.data[1][0],
|
this->data.data[1][0],
|
||||||
this->data.data[1][1],
|
this->data.data[1][1],
|
||||||
this->data.data[2][0],
|
this->data.data[2][0],
|
||||||
this->data.data[2][1]
|
this->data.data[2][1]);
|
||||||
);
|
|
||||||
|
|
||||||
std::cout << "CalibrateCompass::useData " << *this << std::endl;
|
std::cout << "CalibrateCompass::useData " << *this << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrateCompass::removeCalibration() {
|
void CalibrateCompass::removeCalibration()
|
||||||
|
{
|
||||||
this->compass->clearCalibration();
|
this->compass->clearCalibration();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrateCompass::reset() {
|
void CalibrateCompass::reset()
|
||||||
|
{
|
||||||
this->clearData();
|
this->clearData();
|
||||||
this->state = State::Ready;
|
this->state = State::Ready;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrateCompass::saveData() {
|
void CalibrateCompass::saveData()
|
||||||
|
{
|
||||||
if (!this->dataValid)
|
if (!this->dataValid)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Preferences preferences;
|
Preferences preferences;
|
||||||
preferences.begin("compass", false);
|
preferences.begin("compass", false);
|
||||||
|
|
||||||
preferences.putInt("xLow", this->data.data[0][0]);
|
preferences.putInt("xLow", this->data.data[0][0]);
|
||||||
preferences.putInt("xHigh", this->data.data[0][1]);
|
preferences.putInt("xHigh", this->data.data[0][1]);
|
||||||
preferences.putInt("yLow", this->data.data[1][0]);
|
preferences.putInt("yLow", this->data.data[1][0]);
|
||||||
@@ -123,7 +143,8 @@ void CalibrateCompass::saveData() {
|
|||||||
preferences.end();
|
preferences.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrateCompass::loadData() {
|
void CalibrateCompass::loadData()
|
||||||
|
{
|
||||||
Preferences preferences;
|
Preferences preferences;
|
||||||
preferences.begin("compass", true);
|
preferences.begin("compass", true);
|
||||||
|
|
||||||
@@ -138,20 +159,23 @@ void CalibrateCompass::loadData() {
|
|||||||
this->checkDataValidity();
|
this->checkDataValidity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrateCompass::clearData() {
|
void CalibrateCompass::clearData()
|
||||||
for (uint8_t i = 0; i < 3; i++) {
|
{
|
||||||
|
for (uint8_t i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
this->data.data[i][0] = 0;
|
this->data.data[i][0] = 0;
|
||||||
this->data.data[i][1] = 0;
|
this->data.data[i][1] = 0;
|
||||||
}
|
}
|
||||||
this->dataValid = false;
|
this->dataValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrateCompass::checkDataValidity() {
|
void CalibrateCompass::checkDataValidity()
|
||||||
|
{
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
for (uint8_t i = 0; i < 3; i++) {
|
for (uint8_t i = 0; i < 3; i++)
|
||||||
if (this->data.data[i][0] > INT16_MAX || this->data.data[i][0] < INT16_MIN
|
{
|
||||||
|| this->data.data[i][1] > INT16_MAX || this->data.data[i][1] < INT16_MIN)
|
if (this->data.data[i][0] > INT16_MAX || this->data.data[i][0] < INT16_MIN || this->data.data[i][1] > INT16_MAX || this->data.data[i][1] < INT16_MIN)
|
||||||
{
|
{
|
||||||
this->dataValid = false;
|
this->dataValid = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -161,7 +185,8 @@ void CalibrateCompass::checkDataValidity() {
|
|||||||
this->dataValid = sum;
|
this->dataValid = sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const CalibrateCompass& caliComp) {
|
std::ostream &operator<<(std::ostream &os, const CalibrateCompass &caliComp)
|
||||||
|
{
|
||||||
os << "(";
|
os << "(";
|
||||||
os << caliComp.data.data[0][0];
|
os << caliComp.data.data[0][0];
|
||||||
os << ", ";
|
os << ", ";
|
||||||
|
|||||||
+23
-1
@@ -30,7 +30,11 @@ build_type = debug
|
|||||||
monitor_filters = esp32_exception_decoder
|
monitor_filters = esp32_exception_decoder
|
||||||
check_tool = clangtidy
|
check_tool = clangtidy
|
||||||
check_flags =
|
check_flags =
|
||||||
clangtidy: --checks=*,-llvmlibc
|
clangtidy: --checks=-*,cert-*,cppcoreguidelines-*,clang-analyzer-*,google-*,hicpp-*,modernize-*,performance-*,portability-*,readability-*,bugprone-*,misc-*,openmp-*,objc-* --fix
|
||||||
|
check_src_filters =
|
||||||
|
+<src/*>
|
||||||
|
+<lib/*>
|
||||||
|
+<include/*>
|
||||||
|
|
||||||
[env:native]
|
[env:native]
|
||||||
platform = native
|
platform = native
|
||||||
@@ -38,3 +42,21 @@ test_ignore = test_embedded
|
|||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
description = A Rover who should be drive a route by gps.
|
description = A Rover who should be drive a route by gps.
|
||||||
|
|
||||||
|
|
||||||
|
; Bei Möglichkeit folgendes aus clang tidy entfernen
|
||||||
|
; cppcoreguidelines-owning-memory
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
;
|
||||||
|
#
|
||||||
|
|||||||
@@ -1,36 +1,44 @@
|
|||||||
/**
|
/**
|
||||||
* @file menuRoute.cpp
|
* @file menuRoute.cpp
|
||||||
* @author Alexander Klein (alex@kleiax.de)
|
* @author Alexander Klein (alex@kleiax.de)
|
||||||
* @brief Contains the implementation of the classes MenuActionRoute, MenuRoute and MenuRouteWrapper.
|
* @brief Contains the implementation of the classes MenuActionRoute, MenuRoute and MenuRouteWrapper.
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2022-12-28
|
* @date 2022-12-28
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2022
|
* @copyright Copyright (c) 2022
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "menuRoute.h"
|
#include "menuRoute.h"
|
||||||
|
|
||||||
MenuActionRoute::MenuActionRoute(MenuRoute* menuRoute, DataFunction dataFunction) {
|
MenuActionRoute::MenuActionRoute(MenuRoute *menuRoute, DataFunction dataFunction)
|
||||||
|
{
|
||||||
this->menuRoute = menuRoute;
|
this->menuRoute = menuRoute;
|
||||||
this->dataFunction = dataFunction;
|
this->dataFunction = dataFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuActionRoute::action() {
|
void MenuActionRoute::action()
|
||||||
|
{
|
||||||
(this->menuRoute->*this->dataFunction)(0);
|
(this->menuRoute->*this->dataFunction)(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuRoute::MenuRoute(Route* route) {
|
MenuRoute::MenuRoute(Route *route)
|
||||||
|
{
|
||||||
this->route = route;
|
this->route = route;
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuRoute::~MenuRoute() {
|
MenuRoute::~MenuRoute()
|
||||||
|
{
|
||||||
if (isInit)
|
if (isInit)
|
||||||
|
{
|
||||||
delete this->mainMenu;
|
delete this->mainMenu;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuRoute::printMenu() {
|
void MenuRoute::printMenu()
|
||||||
if (!this->isInit) {
|
{
|
||||||
|
if (!this->isInit)
|
||||||
|
{
|
||||||
this->isInit = true;
|
this->isInit = true;
|
||||||
this->init();
|
this->init();
|
||||||
}
|
}
|
||||||
@@ -38,72 +46,103 @@ void MenuRoute::printMenu() {
|
|||||||
this->mainMenu->printMenu();
|
this->mainMenu->printMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MenuRoute::down()
|
||||||
void MenuRoute::down() {
|
{
|
||||||
if (blockInput) return;
|
if (blockInput)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
this->mainMenu->down();
|
this->mainMenu->down();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuRoute::up() {
|
void MenuRoute::up()
|
||||||
if (blockInput) return;
|
{
|
||||||
|
if (blockInput)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
this->mainMenu->up();
|
this->mainMenu->up();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuRoute::right() {
|
void MenuRoute::right()
|
||||||
if (blockInput) return;
|
{
|
||||||
|
if (blockInput)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
this->mainMenu->right();
|
this->mainMenu->right();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuRoute::left() {
|
void MenuRoute::left()
|
||||||
if (blockInput) return;
|
{
|
||||||
|
if (blockInput)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this->mainMenu->isInSubmenu())
|
if (this->mainMenu->isInSubmenu())
|
||||||
|
{
|
||||||
this->mainMenu->left();
|
this->mainMenu->left();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
this->parentMenu->printMenu();
|
this->parentMenu->printMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuRoute::yes() {
|
void MenuRoute::yes()
|
||||||
if (blockInput) return;
|
{
|
||||||
|
if (blockInput)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
this->mainMenu->yes();
|
this->mainMenu->yes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuRoute::no() {
|
void MenuRoute::no()
|
||||||
if (blockInput) return;
|
{
|
||||||
|
if (blockInput)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (this->mainMenu->isInSubmenu())
|
if (this->mainMenu->isInSubmenu())
|
||||||
|
{
|
||||||
this->mainMenu->no();
|
this->mainMenu->no();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
this->left();
|
this->left();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MenuRoute::init()
|
||||||
void MenuRoute::init() {
|
{
|
||||||
// auto dummy = []() {
|
// auto dummy = []() {
|
||||||
// std::cout << "Dummy in Action" <<std::endl;
|
// std::cout << "Dummy in Action" <<std::endl;
|
||||||
// };
|
// };
|
||||||
|
|
||||||
this->mainMenu = new Menu;
|
this->mainMenu = new Menu;
|
||||||
MenuRoutePoints* pointsMenu = new MenuRoutePoints(this->route);
|
auto *pointsMenu = new MenuRoutePoints(this->route);
|
||||||
|
|
||||||
this->mainMenu->setLcd(this->lcd);
|
this->mainMenu->setLcd(this->lcd);
|
||||||
pointsMenu->setLcd(this->lcd);
|
pointsMenu->setLcd(this->lcd);
|
||||||
|
|
||||||
auto importWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::importRoute));
|
auto *importWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::importRoute));
|
||||||
auto exportWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::exportRoute));
|
auto *exportWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::exportRoute));
|
||||||
auto deleteWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::deleteRoute));
|
auto *deleteWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::deleteRoute));
|
||||||
auto clearWrapper = new MenuActionRoute(this, &MenuRoute::clearRoute);
|
auto *clearWrapper = new MenuActionRoute(this, &MenuRoute::clearRoute);
|
||||||
|
|
||||||
importWrapper->setLcd(this->lcd);
|
importWrapper->setLcd(this->lcd);
|
||||||
importWrapper->setMinMax(0, 100);
|
importWrapper->setMinMax(0, MenuRoute::maxRouteNumber);
|
||||||
importWrapper->setPrintParentMenu(false);
|
importWrapper->setPrintParentMenu(false);
|
||||||
importWrapper->setEntry(0, "Import Route");
|
importWrapper->setEntry(0, "Import Route");
|
||||||
|
|
||||||
exportWrapper->setLcd(this->lcd);
|
exportWrapper->setLcd(this->lcd);
|
||||||
exportWrapper->setMinMax(0, 100);
|
exportWrapper->setMinMax(0, MenuRoute::maxRouteNumber);
|
||||||
exportWrapper->setPrintParentMenu(false);
|
exportWrapper->setPrintParentMenu(false);
|
||||||
exportWrapper->setEntry(0, "Export Route");
|
exportWrapper->setEntry(0, "Export Route");
|
||||||
|
|
||||||
deleteWrapper->setLcd(this->lcd);
|
deleteWrapper->setLcd(this->lcd);
|
||||||
deleteWrapper->setMinMax(0, 100);
|
deleteWrapper->setMinMax(0, MenuRoute::maxRouteNumber);
|
||||||
deleteWrapper->setPrintParentMenu(false);
|
deleteWrapper->setPrintParentMenu(false);
|
||||||
deleteWrapper->setEntry(0, "Delete Route");
|
deleteWrapper->setEntry(0, "Delete Route");
|
||||||
|
|
||||||
@@ -114,13 +153,15 @@ void MenuRoute::init() {
|
|||||||
this->mainMenu->addEntry(new MenuAction("Delete", deleteWrapper));
|
this->mainMenu->addEntry(new MenuAction("Delete", deleteWrapper));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuRoute::importRoute(uint8_t routeNumber) {
|
void MenuRoute::importRoute(uint8_t routeNumber)
|
||||||
|
{
|
||||||
this->blockInput = true;
|
this->blockInput = true;
|
||||||
|
|
||||||
String lineOne = "";
|
String lineOne = "";
|
||||||
String lineTwo = "";
|
String lineTwo = "";
|
||||||
|
|
||||||
if (WiFi.status() != WL_CONNECTED) {
|
if (WiFi.status() != WL_CONNECTED)
|
||||||
|
{
|
||||||
lineOne = "Not connected to";
|
lineOne = "Not connected to";
|
||||||
lineTwo = "the WiFi.";
|
lineTwo = "the WiFi.";
|
||||||
this->print(lineOne, lineTwo);
|
this->print(lineOne, lineTwo);
|
||||||
@@ -128,7 +169,8 @@ void MenuRoute::importRoute(uint8_t routeNumber) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE) {
|
if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE)
|
||||||
|
{
|
||||||
lineOne = "Not enough mem";
|
lineOne = "Not enough mem";
|
||||||
lineTwo = "for Json obj";
|
lineTwo = "for Json obj";
|
||||||
this->print(lineOne, lineTwo);
|
this->print(lineOne, lineTwo);
|
||||||
@@ -139,7 +181,7 @@ void MenuRoute::importRoute(uint8_t routeNumber) {
|
|||||||
WiFiClient client;
|
WiFiClient client;
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
DynamicJsonDocument doc(JSON_DOCUMENT_SIZE_ROUTE);
|
DynamicJsonDocument doc(JSON_DOCUMENT_SIZE_ROUTE);
|
||||||
|
|
||||||
String host = "http://rover.kleiax.de/api/";
|
String host = "http://rover.kleiax.de/api/";
|
||||||
host.concat(routeNumber);
|
host.concat(routeNumber);
|
||||||
http.begin(client, host);
|
http.begin(client, host);
|
||||||
@@ -149,14 +191,19 @@ void MenuRoute::importRoute(uint8_t routeNumber) {
|
|||||||
lineTwo = "Code: ";
|
lineTwo = "Code: ";
|
||||||
|
|
||||||
if (httpResponseCode == 202)
|
if (httpResponseCode == 202)
|
||||||
|
{
|
||||||
deserializeJson(doc, http.getStream());
|
deserializeJson(doc, http.getStream());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
lineOne = "HTTP Error";
|
lineOne = "HTTP Error";
|
||||||
|
}
|
||||||
|
|
||||||
lineTwo.concat(httpResponseCode);
|
lineTwo.concat(httpResponseCode);
|
||||||
this->print(lineOne, lineTwo);
|
this->print(lineOne, lineTwo);
|
||||||
|
|
||||||
if (httpResponseCode <= 0) {
|
if (httpResponseCode <= 0)
|
||||||
|
{
|
||||||
this->blockInput = false;
|
this->blockInput = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -164,7 +211,8 @@ void MenuRoute::importRoute(uint8_t routeNumber) {
|
|||||||
uint16_t totalPoints = doc["amountPoints"];
|
uint16_t totalPoints = doc["amountPoints"];
|
||||||
|
|
||||||
this->route->clear();
|
this->route->clear();
|
||||||
for (uint16_t i = 0; i < totalPoints; i++) {
|
for (uint16_t i = 0; i < totalPoints; i++)
|
||||||
|
{
|
||||||
Point::Coordinates coords;
|
Point::Coordinates coords;
|
||||||
coords.lat = doc["points"][i][0].as<double>();
|
coords.lat = doc["points"][i][0].as<double>();
|
||||||
coords.lon = doc["points"][i][1].as<double>();
|
coords.lon = doc["points"][i][1].as<double>();
|
||||||
@@ -175,14 +223,16 @@ void MenuRoute::importRoute(uint8_t routeNumber) {
|
|||||||
http.end();
|
http.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuRoute::exportRoute(uint8_t routeNumber) {
|
void MenuRoute::exportRoute(uint8_t routeNumber)
|
||||||
|
{
|
||||||
this->blockInput = true;
|
this->blockInput = true;
|
||||||
uint16_t totalPoints = this->route->getRouteInfo().totalPoints;
|
uint16_t totalPoints = this->route->getRouteInfo().totalPoints;
|
||||||
|
|
||||||
String lineOne = "";
|
String lineOne = "";
|
||||||
String lineTwo = "";
|
String lineTwo = "";
|
||||||
|
|
||||||
if (WiFi.status() != WL_CONNECTED) {
|
if (WiFi.status() != WL_CONNECTED)
|
||||||
|
{
|
||||||
lineOne = "Not connected to";
|
lineOne = "Not connected to";
|
||||||
lineTwo = "the WiFi.";
|
lineTwo = "the WiFi.";
|
||||||
this->print(lineOne, lineTwo);
|
this->print(lineOne, lineTwo);
|
||||||
@@ -190,7 +240,8 @@ void MenuRoute::exportRoute(uint8_t routeNumber) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE) {
|
if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE)
|
||||||
|
{
|
||||||
lineOne = "Not enough mem";
|
lineOne = "Not enough mem";
|
||||||
lineTwo = "for Json obj";
|
lineTwo = "for Json obj";
|
||||||
this->print(lineOne, lineTwo);
|
this->print(lineOne, lineTwo);
|
||||||
@@ -205,7 +256,8 @@ void MenuRoute::exportRoute(uint8_t routeNumber) {
|
|||||||
Point::Coordinates coords = this->route->startRoute().getCoordinates();
|
Point::Coordinates coords = this->route->startRoute().getCoordinates();
|
||||||
doc["points"][0][0] = coords.lat;
|
doc["points"][0][0] = coords.lat;
|
||||||
doc["points"][0][1] = coords.lon;
|
doc["points"][0][1] = coords.lon;
|
||||||
for (uint16_t i = 1; i < totalPoints; i++) {
|
for (uint16_t i = 1; i < totalPoints; i++)
|
||||||
|
{
|
||||||
coords = this->route->getNextPoint().getCoordinates();
|
coords = this->route->getNextPoint().getCoordinates();
|
||||||
doc["points"][i][0] = coords.lat;
|
doc["points"][i][0] = coords.lat;
|
||||||
doc["points"][i][1] = coords.lon;
|
doc["points"][i][1] = coords.lon;
|
||||||
@@ -215,30 +267,36 @@ void MenuRoute::exportRoute(uint8_t routeNumber) {
|
|||||||
|
|
||||||
WiFiClient client;
|
WiFiClient client;
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
|
|
||||||
http.begin(client, "http://rover.kleiax.de/api/");
|
http.begin(client, "http://rover.kleiax.de/api/");
|
||||||
http.addHeader("Content-Type", "application/json");
|
http.addHeader("Content-Type", "application/json");
|
||||||
int httpResponseCode = http.POST(jsonData);
|
int httpResponseCode = http.POST(jsonData);
|
||||||
|
|
||||||
if (httpResponseCode == 201)
|
if (httpResponseCode == 201)
|
||||||
|
{
|
||||||
lineOne = "Export complete";
|
lineOne = "Export complete";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
lineOne = "HTTP Error";
|
lineOne = "HTTP Error";
|
||||||
|
}
|
||||||
lineTwo = "Code: ";
|
lineTwo = "Code: ";
|
||||||
lineTwo.concat(httpResponseCode);
|
lineTwo.concat(httpResponseCode);
|
||||||
this->print(lineOne, lineTwo);
|
this->print(lineOne, lineTwo);
|
||||||
this->blockInput = false;
|
this->blockInput = false;
|
||||||
|
|
||||||
http.end();
|
http.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuRoute::deleteRoute(uint8_t routeNumber) {
|
void MenuRoute::deleteRoute(uint8_t routeNumber)
|
||||||
|
{
|
||||||
this->blockInput = true;
|
this->blockInput = true;
|
||||||
|
|
||||||
String lineOne = "";
|
String lineOne = "";
|
||||||
String lineTwo = "";
|
String lineTwo = "";
|
||||||
|
|
||||||
if (WiFi.status() != WL_CONNECTED) {
|
if (WiFi.status() != WL_CONNECTED)
|
||||||
|
{
|
||||||
lineOne = "Not connected to";
|
lineOne = "Not connected to";
|
||||||
lineTwo = "the WiFi.";
|
lineTwo = "the WiFi.";
|
||||||
this->print(lineOne, lineTwo);
|
this->print(lineOne, lineTwo);
|
||||||
@@ -246,7 +304,8 @@ void MenuRoute::deleteRoute(uint8_t routeNumber) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE) {
|
if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE)
|
||||||
|
{
|
||||||
lineOne = "Not enough mem";
|
lineOne = "Not enough mem";
|
||||||
lineTwo = "for Json obj";
|
lineTwo = "for Json obj";
|
||||||
this->print(lineOne, lineTwo);
|
this->print(lineOne, lineTwo);
|
||||||
@@ -257,7 +316,7 @@ void MenuRoute::deleteRoute(uint8_t routeNumber) {
|
|||||||
WiFiClient client;
|
WiFiClient client;
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
DynamicJsonDocument doc(JSON_DOCUMENT_SIZE_ROUTE);
|
DynamicJsonDocument doc(JSON_DOCUMENT_SIZE_ROUTE);
|
||||||
|
|
||||||
String host = "http://rover.kleiax.de/api/";
|
String host = "http://rover.kleiax.de/api/";
|
||||||
host.concat(routeNumber);
|
host.concat(routeNumber);
|
||||||
http.begin(client, host);
|
http.begin(client, host);
|
||||||
@@ -267,9 +326,13 @@ void MenuRoute::deleteRoute(uint8_t routeNumber) {
|
|||||||
lineTwo = "Code: ";
|
lineTwo = "Code: ";
|
||||||
|
|
||||||
if (httpResponseCode == 202)
|
if (httpResponseCode == 202)
|
||||||
|
{
|
||||||
deserializeJson(doc, http.getStream());
|
deserializeJson(doc, http.getStream());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
lineOne = "HTTP Error";
|
lineOne = "HTTP Error";
|
||||||
|
}
|
||||||
|
|
||||||
lineTwo.concat(httpResponseCode);
|
lineTwo.concat(httpResponseCode);
|
||||||
this->print(lineOne, lineTwo);
|
this->print(lineOne, lineTwo);
|
||||||
@@ -278,29 +341,37 @@ void MenuRoute::deleteRoute(uint8_t routeNumber) {
|
|||||||
http.end();
|
http.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuRoute::clearRoute(uint8_t none) {
|
void MenuRoute::clearRoute(uint8_t none)
|
||||||
|
{
|
||||||
|
//The parameter exist only for compability
|
||||||
|
none;
|
||||||
this->route->clear();
|
this->route->clear();
|
||||||
this->print("Currente route", "deleted...");
|
this->print("Currente route", "deleted...");
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuRouteWrapper::MenuRouteWrapper(MenuRoute* menuRoute, DataFunction dataFunction) {
|
MenuRouteWrapper::MenuRouteWrapper(MenuRoute *menuRoute, DataFunction dataFunction)
|
||||||
this->menuRoute = menuRoute;
|
: menuRoute {menuRoute}, dataFunction {dataFunction}
|
||||||
this->dataFunction = dataFunction;
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuRouteWrapper::action(int16_t* values, uint8_t length) {
|
void MenuRouteWrapper::action(int16_t *values, uint8_t length)
|
||||||
if (length < 1) {
|
{
|
||||||
|
if (length < 1)
|
||||||
|
{
|
||||||
std::cout << "Error in MenuRouteWrapper::action" << std::endl;
|
std::cout << "Error in MenuRouteWrapper::action" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (values[0] < 0)
|
if (values[0] < 0)
|
||||||
|
{
|
||||||
values[0] = 0;
|
values[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (values[0] > UINT8_MAX)
|
if (values[0] > UINT8_MAX)
|
||||||
|
{
|
||||||
values[0] = UINT8_MAX;
|
values[0] = UINT8_MAX;
|
||||||
|
}
|
||||||
|
|
||||||
(this->menuRoute->*this->dataFunction)(values[0]);
|
(this->menuRoute->*this->dataFunction)(values[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -126,6 +126,12 @@ class MenuRoute : public MenuControl {
|
|||||||
|
|
||||||
bool isInit = false;
|
bool isInit = false;
|
||||||
bool blockInput = false;
|
bool blockInput = false;
|
||||||
|
|
||||||
|
static constexpr uint8_t maxRouteNumber = 100;
|
||||||
|
static constexpr uint16_t httpValidExport = 201;
|
||||||
|
static constexpr uint16_t httpValidImport = 202;
|
||||||
|
static constexpr uint16_t httpValidDelete = 202;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,8 +10,9 @@
|
|||||||
*/
|
*/
|
||||||
#include "menuTestMode.h"
|
#include "menuTestMode.h"
|
||||||
|
|
||||||
MenuTestMode::MenuTestMode(DriveManager* driveManager) {
|
MenuTestMode::MenuTestMode(DriveManager* driveManager)
|
||||||
this->driveManager = driveManager;
|
: driveManager {driveManager}
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuTestMode::~MenuTestMode() {
|
MenuTestMode::~MenuTestMode() {
|
||||||
@@ -30,73 +31,77 @@ void MenuTestMode::printMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuTestMode::down() {
|
void MenuTestMode::down() {
|
||||||
if (this->checkInput())
|
if (this->checkInput()) {
|
||||||
this->mainMenu->down();
|
this->mainMenu->down();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuTestMode::up() {
|
void MenuTestMode::up() {
|
||||||
if (this->checkInput())
|
if (this->checkInput()) {
|
||||||
this->mainMenu->up();
|
this->mainMenu->up();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuTestMode::right() {
|
void MenuTestMode::right() {
|
||||||
if (this->checkInput())
|
if (this->checkInput()) {
|
||||||
this->mainMenu->right();
|
this->mainMenu->right();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuTestMode::left() {
|
void MenuTestMode::left() {
|
||||||
if (this->mainMenu->isInSubmenu())
|
if (this->mainMenu->isInSubmenu())
|
||||||
if (this->checkInput())
|
if (this->checkInput()) {
|
||||||
this->mainMenu->left();
|
this->mainMenu->left();
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
this->testMode->abortManeuver();
|
this->testMode->abortManeuver();
|
||||||
this->mainMenu->left();
|
this->mainMenu->left();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
this->parentMenu->printMenu();
|
this->parentMenu->printMenu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuTestMode::yes() {
|
void MenuTestMode::yes() {
|
||||||
if (this->checkInput())
|
if (this->checkInput()) {
|
||||||
this->mainMenu->yes();
|
this->mainMenu->yes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuTestMode::no() {
|
void MenuTestMode::no() {
|
||||||
if (this->mainMenu->isInSubmenu())
|
if (this->mainMenu->isInSubmenu()) {
|
||||||
if (this->checkInput())
|
if (this->checkInput())
|
||||||
this->mainMenu->no();
|
this->mainMenu->no();
|
||||||
else {
|
else {
|
||||||
this->testMode->abortManeuver();
|
this->testMode->abortManeuver();
|
||||||
this->mainMenu->no();
|
this->mainMenu->no();
|
||||||
}
|
}}
|
||||||
else
|
else{
|
||||||
this->left();
|
this->left();}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuTestMode::init() {
|
void MenuTestMode::init() {
|
||||||
this->testMode = new TestMode();
|
this->testMode = new TestMode();
|
||||||
this->driveManager->changeModus(this->testMode);
|
this->driveManager->changeModus(this->testMode);
|
||||||
|
|
||||||
this->testMode->setSpeeds(DrivingSpeeds{1, 8});
|
|
||||||
|
|
||||||
auto dummy = []() {
|
auto dummy = []() {
|
||||||
std::cout << "Dummy in Action" <<std::endl;
|
std::cout << "Dummy in Action" <<std::endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create menu
|
// Create menu
|
||||||
this->mainMenu = new Menu;
|
this->mainMenu = new Menu;
|
||||||
auto engineMenu = new Menu;
|
auto *engineMenu = new Menu;
|
||||||
auto lightMenu = new Menu;
|
auto *lightMenu = new Menu;
|
||||||
auto encoderMenu = new Menu;
|
auto *encoderMenu = new Menu;
|
||||||
// Sound
|
// Sound
|
||||||
// Ping google
|
// Ping google
|
||||||
|
|
||||||
auto drivingMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::drive));
|
auto *drivingMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::drive));
|
||||||
auto engineLeftMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::leftEngine));
|
auto *engineLeftMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::leftEngine));
|
||||||
auto engineRightMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::rightEngine));
|
auto *engineRightMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::rightEngine));
|
||||||
auto engineBothMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::bothEngine));
|
auto *engineBothMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::bothEngine));
|
||||||
auto encoderLeftMenu = new SpeedometerTest(this->testMode->getSpeedometerLeft());
|
auto *encoderLeftMenu = new SpeedometerTest(this->testMode->getSpeedometerLeft());
|
||||||
auto encoderRightMenu = new SpeedometerTest(this->testMode->getSpeedometerRight());
|
auto *encoderRightMenu = new SpeedometerTest(this->testMode->getSpeedometerRight());
|
||||||
|
|
||||||
|
|
||||||
// Set menus on LCD
|
// Set menus on LCD
|
||||||
@@ -112,47 +117,52 @@ void MenuTestMode::init() {
|
|||||||
encoderRightMenu->setLcd(this->lcd);
|
encoderRightMenu->setLcd(this->lcd);
|
||||||
|
|
||||||
// Other menu config
|
// Other menu config
|
||||||
|
static constexpr uint8_t percentMax = 100;
|
||||||
|
static constexpr uint8_t degreeMax = 360;
|
||||||
|
static constexpr uint8_t secondsMax = 120;
|
||||||
|
static constexpr uint8_t steps = 5;
|
||||||
|
|
||||||
drivingMenu->setEntry(0, "Centimeter", 100);
|
drivingMenu->setEntry(0, "Centimeter", 100);
|
||||||
drivingMenu->setMinMaxSteps(0, -1000, 1000, 25);
|
drivingMenu->setMinMaxSteps(0, -1000, 1000, steps * 5);
|
||||||
drivingMenu->setEntry(1, "Degree");
|
drivingMenu->setEntry(1, "Degree");
|
||||||
drivingMenu->setMinMaxSteps(1, -360, 360, 15);
|
drivingMenu->setMinMaxSteps(1, -degreeMax, degreeMax, steps * 3);
|
||||||
drivingMenu->setPrintParentMenu(false);
|
drivingMenu->setPrintParentMenu(false);
|
||||||
engineLeftMenu->setEntry(0, "Percentage");
|
engineLeftMenu->setEntry(0, "Percentage");
|
||||||
engineLeftMenu->setMinMaxSteps(0, -100, 100, 5);
|
engineLeftMenu->setMinMaxSteps(0, -percentMax, percentMax, steps);
|
||||||
engineLeftMenu->setEntry(1, "Seconds", 5);
|
engineLeftMenu->setEntry(1, "Seconds", steps);
|
||||||
engineLeftMenu->setMinMaxSteps(1, 0, 120, 1);
|
engineLeftMenu->setMinMaxSteps(1, 0, secondsMax, 1);
|
||||||
engineLeftMenu->setPrintParentMenu(false);
|
engineLeftMenu->setPrintParentMenu(false);
|
||||||
engineRightMenu->setEntry(0, "Percentage");
|
engineRightMenu->setEntry(0, "Percentage");
|
||||||
engineRightMenu->setMinMaxSteps(0, -100, 100, 5);
|
engineRightMenu->setMinMaxSteps(0, -percentMax, percentMax, steps);
|
||||||
engineRightMenu->setEntry(1, "Seconds", 5);
|
engineRightMenu->setEntry(1, "Seconds", steps);
|
||||||
engineRightMenu->setMinMaxSteps(1, 0, 120, 1);
|
engineRightMenu->setMinMaxSteps(1, 0, secondsMax, 1);
|
||||||
engineRightMenu->setPrintParentMenu(false);
|
engineRightMenu->setPrintParentMenu(false);
|
||||||
engineBothMenu->setEntry(0, "Percentage");
|
engineBothMenu->setEntry(0, "Percentage");
|
||||||
engineBothMenu->setMinMaxSteps(0, -100, 100, 5);
|
engineBothMenu->setMinMaxSteps(0, -percentMax, percentMax, steps);
|
||||||
engineBothMenu->setEntry(1, "Seconds", 5);
|
engineBothMenu->setEntry(1, "Seconds", steps);
|
||||||
engineBothMenu->setMinMaxSteps(1, 0, 120, 1);
|
engineBothMenu->setMinMaxSteps(1, 0, secondsMax, 1);
|
||||||
engineBothMenu->setPrintParentMenu(false);
|
engineBothMenu->setPrintParentMenu(false);
|
||||||
|
|
||||||
|
|
||||||
// Entrys for the menus
|
// Entrys for the menus
|
||||||
MenuAction* engineAction = new MenuAction("Engine", engineMenu);
|
auto *engineAction = new MenuAction("Engine", engineMenu);
|
||||||
MenuAction* engineLeftAction = new MenuAction("Left", engineLeftMenu);
|
auto *engineLeftAction = new MenuAction("Left", engineLeftMenu);
|
||||||
MenuAction* engineRightAction = new MenuAction("Right", engineRightMenu);
|
auto *engineRightAction = new MenuAction("Right", engineRightMenu);
|
||||||
MenuAction* engineBothAction = new MenuAction("Both", engineBothMenu);
|
auto *engineBothAction = new MenuAction("Both", engineBothMenu);
|
||||||
|
|
||||||
MenuAction* drivingAction = new MenuAction("Driving", drivingMenu);
|
auto *drivingAction = new MenuAction("Driving", drivingMenu);
|
||||||
|
|
||||||
MenuAction* encoderAction = new MenuAction("Encoder", encoderMenu);
|
auto *encoderAction = new MenuAction("Encoder", encoderMenu);
|
||||||
MenuAction* encoderLeftAction = new MenuAction("Left", encoderLeftMenu);
|
auto *encoderLeftAction = new MenuAction("Left", encoderLeftMenu);
|
||||||
MenuAction* encoderRightAction = new MenuAction("Right", encoderRightMenu);
|
auto *encoderRightAction = new MenuAction("Right", encoderRightMenu);
|
||||||
|
|
||||||
MenuAction* lightAction = new MenuAction("Light", lightMenu);
|
auto *lightAction = new MenuAction("Light", lightMenu);
|
||||||
MenuAction* lightFlashAction = new MenuAction("Flash", dummy);
|
auto *lightFlashAction = new MenuAction("Flash", dummy);
|
||||||
MenuAction* lightFadeAction = new MenuAction("Fade", dummy);
|
auto *lightFadeAction = new MenuAction("Fade", dummy);
|
||||||
MenuAction* lightRedAction = new MenuAction("Red", dummy);
|
auto *lightRedAction = new MenuAction("Red", dummy);
|
||||||
MenuAction* lightGreenAction = new MenuAction("Green", dummy);
|
auto *lightGreenAction = new MenuAction("Green", dummy);
|
||||||
MenuAction* lightBlueAction = new MenuAction("Blue", dummy);
|
auto *lightBlueAction = new MenuAction("Blue", dummy);
|
||||||
MenuAction* lightOffAction = new MenuAction("Off", dummy);
|
auto *lightOffAction = new MenuAction("Off", dummy);
|
||||||
|
|
||||||
// Add entrys to the menus
|
// Add entrys to the menus
|
||||||
this->mainMenu->addEntry(engineAction);
|
this->mainMenu->addEntry(engineAction);
|
||||||
@@ -176,11 +186,11 @@ void MenuTestMode::init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuTestMode::update() {
|
void MenuTestMode::update() {
|
||||||
if (this->maneuverInAction)
|
if (this->maneuverInAction) {
|
||||||
if (millis() - this->lastUpdateTime > updateDelay) {
|
if (millis() - this->lastUpdateTime > updateDelay) {
|
||||||
this->printManeuverTime();
|
this->printManeuverTime();
|
||||||
this->lastUpdateTime = millis();
|
this->lastUpdateTime = millis();
|
||||||
}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuTestMode::checkInput() {
|
bool MenuTestMode::checkInput() {
|
||||||
@@ -190,8 +200,9 @@ bool MenuTestMode::checkInput() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->maneuverInAction)
|
if (this->maneuverInAction) {
|
||||||
this->maneuverInAction = false;
|
this->maneuverInAction = false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -209,16 +220,18 @@ void MenuTestMode::printManeuverTime() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuTestModeWrapper::MenuTestModeWrapper(MenuTestMode* menu, TestModeFunctionSingle testModeFunction) {
|
MenuTestModeWrapper::MenuTestModeWrapper(MenuTestMode* menu, TestModeFunctionSingle testModeFunction)
|
||||||
this->menu = menu;
|
: menu {menu},
|
||||||
this->testMode = this->menu->getTestMode();
|
testModeFunctionSingle {testModeFunction},
|
||||||
this->testModeFunctionSingle = testModeFunction;
|
testMode {menu->getTestMode()}
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuTestModeWrapper::MenuTestModeWrapper(MenuTestMode* menu, TestModeFunctionDouble testModeFunction) {
|
MenuTestModeWrapper::MenuTestModeWrapper(MenuTestMode* menu, TestModeFunctionDouble testModeFunction)
|
||||||
this->menu = menu;
|
: menu {menu},
|
||||||
this->testMode = this->menu->getTestMode();
|
testModeFunctionDouble {testModeFunction},
|
||||||
this->testModeFunctionDouble = testModeFunction;
|
testMode {menu->getTestMode()}
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuTestModeWrapper::action(int16_t* values, uint8_t length) {
|
void MenuTestModeWrapper::action(int16_t* values, uint8_t length) {
|
||||||
@@ -228,10 +241,12 @@ void MenuTestModeWrapper::action(int16_t* values, uint8_t length) {
|
|||||||
|
|
||||||
bool res = false;
|
bool res = false;
|
||||||
|
|
||||||
if (length == 2 && this->testModeFunctionDouble)
|
if (length == 2 && static_cast<bool>(this->testModeFunctionDouble)) {
|
||||||
res = (this->testMode->*this->testModeFunctionDouble)(values[0], values[1]);
|
res = (this->testMode->*this->testModeFunctionDouble)(values[0], values[1]);
|
||||||
else if (length == 1 && this->testModeFunctionSingle)
|
}
|
||||||
|
else if (length == 1 && static_cast<bool>(this->testModeFunctionSingle)) {
|
||||||
res = (this->testMode->*this->testModeFunctionSingle)(values[0]);
|
res = (this->testMode->*this->testModeFunctionSingle)(values[0]);
|
||||||
|
}
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
this->menu->printManeuverTime();
|
this->menu->printManeuverTime();
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ class MenuTestMode : public MenuControl {
|
|||||||
bool checkInput();
|
bool checkInput();
|
||||||
|
|
||||||
DriveManager* driveManager;
|
DriveManager* driveManager;
|
||||||
TestMode* testMode;
|
TestMode* testMode = nullptr;
|
||||||
Menu* mainMenu;
|
Menu* mainMenu = nullptr;
|
||||||
|
|
||||||
bool isInit = false;
|
bool isInit = false;
|
||||||
bool maneuverInAction = false;
|
bool maneuverInAction = false;
|
||||||
|
|||||||
@@ -11,8 +11,9 @@
|
|||||||
|
|
||||||
#include "speedometerTest.h"
|
#include "speedometerTest.h"
|
||||||
|
|
||||||
SpeedometerTest::SpeedometerTest(Speedometer* speedometer) {
|
SpeedometerTest::SpeedometerTest(Speedometer* speedometer)
|
||||||
this->speedometer = speedometer;
|
: speedometer {speedometer}
|
||||||
|
{
|
||||||
this->speedometer->setDirection(Speedometer::Forward);
|
this->speedometer->setDirection(Speedometer::Forward);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,8 +47,9 @@ void SpeedometerTest::left() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SpeedometerTest::no() {
|
void SpeedometerTest::no() {
|
||||||
if (this->state == State::Running)
|
if (this->state == State::Running){
|
||||||
speedometer->calibrationMeasurementStop();
|
speedometer->calibrationMeasurementStop();
|
||||||
|
}
|
||||||
|
|
||||||
this->state = State::Off;
|
this->state = State::Off;
|
||||||
this->parentMenu->printMenu();
|
this->parentMenu->printMenu();
|
||||||
|
|||||||
@@ -11,27 +11,28 @@
|
|||||||
|
|
||||||
#include "menuDriveMode.h"
|
#include "menuDriveMode.h"
|
||||||
|
|
||||||
MenuDriveMode::MenuDriveMode(DriveManager* driveManager) {
|
MenuDriveMode::MenuDriveMode(DriveManager* driveManager)
|
||||||
this->driveManager = driveManager;
|
: driveManager {driveManager}
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuDriveMode::left() {
|
void MenuDriveMode::left() {
|
||||||
if (this->activeMenu) {
|
if (static_cast<bool>(this->activeMenu)) {
|
||||||
if (this->activeMenu)
|
if (static_cast<bool>(this->activeMenu)) {
|
||||||
this->activeMenu->left();
|
this->activeMenu->left();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->firstPrint = true;
|
this->firstPrint = true;
|
||||||
this->configureOnLeave();
|
this->configureOnLeave();
|
||||||
if (this->menuSpeed)
|
|
||||||
delete this->menuSpeed;
|
delete this->menuSpeed;
|
||||||
this->driveManager->changeModus();
|
this->driveManager->changeModus();
|
||||||
MenuInformationSites::left();
|
MenuInformationSites::left();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuDriveMode::right() {
|
void MenuDriveMode::right() {
|
||||||
if (this->activeMenu) {
|
if (static_cast<bool>(this->activeMenu)) {
|
||||||
this->activeMenu->right();
|
this->activeMenu->right();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -39,7 +40,7 @@ void MenuDriveMode::right() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuDriveMode::up() {
|
void MenuDriveMode::up() {
|
||||||
if (this->activeMenu) {
|
if (static_cast<bool>(this->activeMenu)) {
|
||||||
this->activeMenu->up();
|
this->activeMenu->up();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -47,7 +48,7 @@ void MenuDriveMode::up() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuDriveMode::down() {
|
void MenuDriveMode::down() {
|
||||||
if (this->activeMenu) {
|
if (static_cast<bool>(this->activeMenu)) {
|
||||||
this->activeMenu->down();
|
this->activeMenu->down();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -55,7 +56,7 @@ void MenuDriveMode::down() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuDriveMode::yes() {
|
void MenuDriveMode::yes() {
|
||||||
if (this->activeMenu) {
|
if (static_cast<bool>(this->activeMenu)) {
|
||||||
this->activeMenu->yes();
|
this->activeMenu->yes();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -63,7 +64,7 @@ void MenuDriveMode::yes() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuDriveMode::no() {
|
void MenuDriveMode::no() {
|
||||||
if (this->activeMenu) {
|
if (static_cast<bool>(this->activeMenu)) {
|
||||||
this->activeMenu->no();
|
this->activeMenu->no();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -75,7 +76,7 @@ void MenuDriveMode::prepareReenterMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuDriveMode::printMenu() {
|
void MenuDriveMode::printMenu() {
|
||||||
if (this->activeMenu) {
|
if (static_cast<bool>(this->activeMenu)) {
|
||||||
this->activeMenu->printMenu();
|
this->activeMenu->printMenu();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -88,11 +89,12 @@ void MenuDriveMode::init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuDriveMode::activateSpeedMenu() {
|
void MenuDriveMode::activateSpeedMenu() {
|
||||||
if (!this->driveManager->isActive())
|
if (!this->driveManager->isActive()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DrivingSpeeds& speeds = this->driveManager->getDriveModiPtr()->getSpeedsRef();
|
DrivingSpeeds& speeds = this->driveManager->getDriveModiPtr()->getSpeedsRef();
|
||||||
MenuIntInput* menu = new MenuIntInput(2, new MenuSpeed(speeds));
|
auto *menu = new MenuIntInput(2, new MenuSpeed(speeds));
|
||||||
|
|
||||||
menu->setMinMax(5, UINT8_MAX);
|
menu->setMinMax(5, UINT8_MAX);
|
||||||
menu->setEntry(0, "x m/s e-1", driveManager->getDrivingSpeedsRef().x * 10);
|
menu->setEntry(0, "x m/s e-1", driveManager->getDrivingSpeedsRef().x * 10);
|
||||||
@@ -112,8 +114,9 @@ void MenuDriveMode::enterSensorMenu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuDriveMode::enterMenu() {
|
void MenuDriveMode::enterMenu() {
|
||||||
if (!this->activeMenu)
|
if (!static_cast<bool>(this->activeMenu)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->activeMenu->printMenu();
|
this->activeMenu->printMenu();
|
||||||
this->activeMenu->setParentMenu(this);
|
this->activeMenu->setParentMenu(this);
|
||||||
|
|||||||
@@ -4,138 +4,161 @@
|
|||||||
* @brief Contains the implementation of the class Autopilot
|
* @brief Contains the implementation of the class Autopilot
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2022-02-02
|
* @date 2022-02-02
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2022
|
* @copyright Copyright (c) 2022
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "driveModi/Modi/Autopilot/autopilot.h"
|
#include "driveModi/Modi/Autopilot/autopilot.h"
|
||||||
#include "autopilot.h"
|
#include "autopilot.h"
|
||||||
|
|
||||||
DirectionChangeSignal::DirectionChangeSignal(Autopilot* pilot) {
|
DirectionChangeSignal::DirectionChangeSignal(Autopilot *pilot)
|
||||||
this->pilot = pilot;
|
: pilot {pilot}
|
||||||
|
{
|
||||||
this->action();
|
this->action();
|
||||||
}
|
}
|
||||||
|
|
||||||
DirectionChangeSignal::~DirectionChangeSignal() {
|
DirectionChangeSignal::~DirectionChangeSignal()
|
||||||
CalcAzimuth* calcAzimuth = pilot->getSensorData()->getCalcCompass();
|
{
|
||||||
if (calcAzimuth)
|
CalcAzimuth *calcAzimuth = pilot->getSensorData()->getCalcCompass();
|
||||||
|
if (static_cast<bool>(calcAzimuth))
|
||||||
|
{
|
||||||
calcAzimuth->disableCalcAzimuth();
|
calcAzimuth->disableCalcAzimuth();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectionChangeSignal::action() {
|
void DirectionChangeSignal::action()
|
||||||
CalcAzimuth* calcAzimuth = pilot->getSensorData()->getCalcCompass();
|
{
|
||||||
if (calcAzimuth)
|
CalcAzimuth *calcAzimuth = pilot->getSensorData()->getCalcCompass();
|
||||||
|
if (static_cast<bool>(calcAzimuth))
|
||||||
|
{
|
||||||
calcAzimuth->drivingDirectionChange(pilot->getSensorData()->getCurrentPos());
|
calcAzimuth->drivingDirectionChange(pilot->getSensorData()->getCurrentPos());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Autopilot::~Autopilot()
|
||||||
Autopilot::Autopilot() {
|
{
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Autopilot::~Autopilot() {
|
|
||||||
delete this->directionChangeSignal;
|
delete this->directionChangeSignal;
|
||||||
// this->navigation->getNTRIPClient()->setActivated(false);
|
// this->navigation->getNTRIPClient()->setActivated(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autopilot::run() {
|
void Autopilot::run()
|
||||||
|
{
|
||||||
this->routeInfo = this->navigation->getRouteInfo();
|
this->routeInfo = this->navigation->getRouteInfo();
|
||||||
|
|
||||||
switch (this->state) {
|
switch (this->state)
|
||||||
case State::InsufficientAccuracy:
|
{
|
||||||
this->askNavigationForOrder();
|
case State::InsufficientAccuracy:
|
||||||
return;
|
this->askNavigationForOrder();
|
||||||
|
return;
|
||||||
|
|
||||||
case State::NoRoute:
|
case State::NoRoute:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case State::None:
|
case State::None:
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case State::NavigationStarted:
|
case State::NavigationStarted:
|
||||||
this->askNavigationForOrder();
|
this->askNavigationForOrder();
|
||||||
this->checkButtonInput();
|
this->checkButtonInput();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case State::GetToStartPoint:
|
case State::GetToStartPoint:
|
||||||
ManualControl::run();
|
ManualControl::run();
|
||||||
this->askNavigationForOrder();
|
this->askNavigationForOrder();
|
||||||
if (this->routeInfo.currentPoint >= 2)
|
if (this->routeInfo.currentPoint >= 2){
|
||||||
this->state = State::SelfDrivingAvailable;
|
this->state = State::SelfDrivingAvailable;
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case State::SelfDrivingAvailable:
|
case State::SelfDrivingAvailable:
|
||||||
ManualControl::run();
|
ManualControl::run();
|
||||||
this->askNavigationForOrder();
|
this->askNavigationForOrder();
|
||||||
this->checkButtonInput();
|
this->checkButtonInput();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case State::SelfDriving:
|
case State::SelfDriving:
|
||||||
this->askNavigationForOrder();
|
this->askNavigationForOrder();
|
||||||
this->checkButtonInput();
|
this->checkButtonInput();
|
||||||
this->selfDriving();
|
this->selfDriving();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SelfDrivingRotate:
|
case SelfDrivingRotate:
|
||||||
this->checkButtonInput();
|
this->checkButtonInput();
|
||||||
this->rotate();
|
this->rotate();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case State::TargetReached:
|
case State::TargetReached:
|
||||||
if (this->loopMode)
|
if (this->loopMode){
|
||||||
this->restartLoop();
|
this->restartLoop();
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
default:
|
|
||||||
break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autopilot::restart() {
|
void Autopilot::restart()
|
||||||
|
{
|
||||||
this->init();
|
this->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Autopilot::shouldUpdate() {
|
bool Autopilot::shouldUpdate()
|
||||||
if (this->updateDisplay) {
|
{
|
||||||
|
if (this->updateDisplay)
|
||||||
|
{
|
||||||
this->updateDisplay = false;
|
this->updateDisplay = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autopilot::testRotate(int16_t degree) {
|
void Autopilot::testRotate(int16_t degree)
|
||||||
if (!degree)
|
{
|
||||||
|
if (!static_cast<bool>(degree))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->courseCorrection.correction = degree;
|
this->courseCorrection.correction = degree;
|
||||||
this->beginRotate();
|
this->beginRotate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autopilot::init() {
|
void Autopilot::init()
|
||||||
|
{
|
||||||
if (this->navigation->startNavigation())
|
if (this->navigation->startNavigation())
|
||||||
this->state = State::NavigationStarted;
|
{
|
||||||
else
|
this->state = State::NavigationStarted;
|
||||||
this->state = State::NoRoute;
|
}
|
||||||
this->routeInfo = this->navigation->getRouteInfo();
|
else
|
||||||
this->sensorData->getNtripClient()->setAutoReconnect(true);
|
{
|
||||||
|
this->state = State::NoRoute;
|
||||||
|
}
|
||||||
|
this->routeInfo = this->navigation->getRouteInfo();
|
||||||
|
this->sensorData->getNtripClient()->setAutoReconnect(true);
|
||||||
|
|
||||||
this->lastOrderStatus = this->navigation->getCourseCorrection(this->courseCorrection, true);
|
this->lastOrderStatus = this->navigation->getCourseCorrection(this->courseCorrection, true);
|
||||||
|
|
||||||
this->courseCorrection.correction = 0;
|
this->courseCorrection.correction = 0;
|
||||||
this->courseCorrection.distance = 0;
|
this->courseCorrection.distance = 0;
|
||||||
this->updateDisplay = true;
|
this->updateDisplay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autopilot::drive() {
|
void Autopilot::drive()
|
||||||
|
{
|
||||||
DrivingSpeeds speeds = {0, 0};
|
DrivingSpeeds speeds = {0, 0};
|
||||||
if (this->courseCorrection.distance >= this->minRemainingDistance)
|
if (this->courseCorrection.distance >= this->minRemainingDistance)
|
||||||
|
{
|
||||||
speeds.x = this->maxSpeeds.x;
|
speeds.x = this->maxSpeeds.x;
|
||||||
|
}
|
||||||
this->moveControl->setSpeeds(speeds);
|
this->moveControl->setSpeeds(speeds);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autopilot::beginRotate() {
|
void Autopilot::beginRotate()
|
||||||
if (this->state != State::SelfDrivingRotate) {
|
{
|
||||||
|
if (this->state != State::SelfDrivingRotate)
|
||||||
|
{
|
||||||
this->lastState = this->state;
|
this->lastState = this->state;
|
||||||
this->state = State::SelfDrivingRotate;
|
this->state = State::SelfDrivingRotate;
|
||||||
this->rotationAimAzimuth = this->getSensorData()->getRealAzimuth() + this->courseCorrection.correction;
|
this->rotationAimAzimuth = this->getSensorData()->getRealAzimuth() + this->courseCorrection.correction;
|
||||||
@@ -143,35 +166,40 @@ void Autopilot::beginRotate() {
|
|||||||
|
|
||||||
DrivingSpeeds speeds = {0, 0};
|
DrivingSpeeds speeds = {0, 0};
|
||||||
if (this->courseCorrection.correction > 0)
|
if (this->courseCorrection.correction > 0)
|
||||||
|
{
|
||||||
speeds.rot = -this->maxSpeeds.rot;
|
speeds.rot = -this->maxSpeeds.rot;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
speeds.rot = this->maxSpeeds.rot;
|
speeds.rot = this->maxSpeeds.rot;
|
||||||
|
}
|
||||||
|
|
||||||
this->moveControl->setSpeeds(speeds);
|
this->moveControl->setSpeeds(speeds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autopilot::rotate() {
|
void Autopilot::rotate()
|
||||||
if (abs(this->getSensorData()->getRealAzimuth() - this->rotationAimAzimuth) < this->maxCourseDeviationBeforeAct) {
|
{
|
||||||
|
if (abs(this->getSensorData()->getRealAzimuth() - this->rotationAimAzimuth) < this->maxCourseDeviationBeforeAct)
|
||||||
|
{
|
||||||
this->endRotate();
|
this->endRotate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((abs(this->getSensorData()->getRealAzimuth() - this->rotationAimAzimuth) < this->maxCourseDeviationBeforeAct * 3)
|
if ((abs(this->getSensorData()->getRealAzimuth() - this->rotationAimAzimuth) < this->maxCourseDeviationBeforeAct * 3) &&
|
||||||
&&
|
((this->courseCorrection.correction > 0 && this->rotationAimAzimuth < this->getSensorData()->getRealAzimuth()) || (this->courseCorrection.correction < 0 && this->rotationAimAzimuth > this->getSensorData()->getRealAzimuth())))
|
||||||
((this->courseCorrection.correction > 0
|
|
||||||
&& this->rotationAimAzimuth < this->getSensorData()->getRealAzimuth())
|
|
||||||
|| (this->courseCorrection.correction < 0
|
|
||||||
&& this->rotationAimAzimuth > this->getSensorData()->getRealAzimuth())))
|
|
||||||
{
|
{
|
||||||
this->endRotate();
|
this->endRotate();
|
||||||
std::cout << "Autopilot::rotate: Rover rotated too far" << std::endl;
|
std::cout << "Autopilot::rotate: Rover rotated too far" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autopilot::endRotate() {
|
void Autopilot::endRotate()
|
||||||
|
{
|
||||||
if (this->state != State::SelfDrivingRotate)
|
if (this->state != State::SelfDrivingRotate)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this->state = this->lastState;
|
this->state = this->lastState;
|
||||||
this->sensorData->getCalcCompass()->drivingDirectionChange(this->sensorData->getCurrentPos());
|
this->sensorData->getCalcCompass()->drivingDirectionChange(this->sensorData->getCurrentPos());
|
||||||
@@ -180,65 +208,85 @@ void Autopilot::endRotate() {
|
|||||||
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autopilot::checkButtonInput() {
|
void Autopilot::checkButtonInput()
|
||||||
if (ControlPadButton::isControlPadButtonPressed(this->input, ControlPadButton::PadButton::Action)
|
{
|
||||||
&& millis() - this->lastAutopilotChangeMillis > this->autopilotChangeDelayMillis) {
|
if (ControlPadButton::isControlPadButtonPressed(this->input, ControlPadButton::PadButton::Action) && millis() - this->lastAutopilotChangeMillis > this->autopilotChangeDelayMillis)
|
||||||
|
{
|
||||||
if (this->state == State::SelfDrivingAvailable)
|
|
||||||
|
if (this->state == State::SelfDrivingAvailable)
|
||||||
|
{
|
||||||
this->state = State::SelfDriving;
|
this->state = State::SelfDriving;
|
||||||
|
}
|
||||||
else if (this->state == State::SelfDriving || this->state == State::SelfDrivingRotate)
|
else if (this->state == State::SelfDriving || this->state == State::SelfDrivingRotate)
|
||||||
|
{
|
||||||
this->state = State::SelfDrivingAvailable;
|
this->state = State::SelfDrivingAvailable;
|
||||||
|
}
|
||||||
else if (this->state == State::NavigationStarted)
|
else if (this->state == State::NavigationStarted)
|
||||||
|
{
|
||||||
this->state = State::GetToStartPoint;
|
this->state = State::GetToStartPoint;
|
||||||
|
}
|
||||||
this->updateDisplay = true;
|
this->updateDisplay = true;
|
||||||
this->lastAutopilotChangeMillis = millis();
|
this->lastAutopilotChangeMillis = millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autopilot::askNavigationForOrder() {
|
void Autopilot::askNavigationForOrder()
|
||||||
|
{
|
||||||
this->lastOrderStatus = this->navigation->getCourseCorrection(this->courseCorrection);
|
this->lastOrderStatus = this->navigation->getCourseCorrection(this->courseCorrection);
|
||||||
switch (this->lastOrderStatus) {
|
switch (this->lastOrderStatus)
|
||||||
case Navigation::Status::Complete:
|
{
|
||||||
this->state = State::TargetReached;
|
case Navigation::Status::Complete:
|
||||||
this->moveControl->setSpeed(0);
|
this->state = State::TargetReached;
|
||||||
this->moveControl->setRotationSpeed(0);
|
this->moveControl->setSpeed(0);
|
||||||
break;
|
this->moveControl->setRotationSpeed(0);
|
||||||
|
break;
|
||||||
case Navigation::Status::InsufficientAccuracy:
|
|
||||||
if (this->state == State::InsufficientAccuracy)
|
|
||||||
break;
|
|
||||||
this->lastState = this->state;
|
|
||||||
this->state = State::InsufficientAccuracy;
|
|
||||||
this->moveControl->setSpeed(0);
|
|
||||||
this->moveControl->setRotationSpeed(0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Navigation::Status::Unchanged:
|
case Navigation::Status::InsufficientAccuracy:
|
||||||
if (this->state == State::InsufficientAccuracy)
|
if (this->state == State::InsufficientAccuracy){
|
||||||
this->state = this->lastState;
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
this->lastState = this->state;
|
||||||
|
this->state = State::InsufficientAccuracy;
|
||||||
|
this->moveControl->setSpeed(0);
|
||||||
|
this->moveControl->setRotationSpeed(0);
|
||||||
|
break;
|
||||||
|
|
||||||
case Navigation::Status::Updated:
|
case Navigation::Status::Unchanged:
|
||||||
if (this->state == State::InsufficientAccuracy)
|
if (this->state == State::InsufficientAccuracy){
|
||||||
this->state = this->lastState;
|
this->state = this->lastState;
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
default:
|
|
||||||
break;
|
case Navigation::Status::Updated:
|
||||||
|
if (this->state == State::InsufficientAccuracy){
|
||||||
|
this->state = this->lastState;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autopilot::selfDriving() {
|
void Autopilot::selfDriving()
|
||||||
|
{
|
||||||
if (this->state != State::SelfDriving)
|
if (this->state != State::SelfDriving)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (abs(this->courseCorrection.correction) >= this->maxCourseDeviationBeforeAct)
|
if (abs(this->courseCorrection.correction) >= this->maxCourseDeviationBeforeAct)
|
||||||
|
{
|
||||||
this->beginRotate();
|
this->beginRotate();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
this->drive();
|
this->drive();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autopilot::restartLoop() {
|
void Autopilot::restartLoop()
|
||||||
|
{
|
||||||
this->navigation->startNavigation();
|
this->navigation->startNavigation();
|
||||||
this->state = State::SelfDriving;
|
this->state = State::SelfDriving;
|
||||||
this->routeInfo = this->navigation->getRouteInfo();
|
this->routeInfo = this->navigation->getRouteInfo();
|
||||||
@@ -246,7 +294,8 @@ void Autopilot::restartLoop() {
|
|||||||
this->updateDisplay = true;
|
this->updateDisplay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Autopilot::afterActivate() {
|
void Autopilot::afterActivate()
|
||||||
|
{
|
||||||
this->setInputMode(ManualControl::InputMode::Digital);
|
this->setInputMode(ManualControl::InputMode::Digital);
|
||||||
this->directionChangeSignal = new DirectionChangeSignal(this);
|
this->directionChangeSignal = new DirectionChangeSignal(this);
|
||||||
this->setDirectionChangeCallback(this->directionChangeSignal);
|
this->setDirectionChangeCallback(this->directionChangeSignal);
|
||||||
|
|||||||
@@ -41,14 +41,6 @@ class Autopilot : public ManualControl {
|
|||||||
TargetReached
|
TargetReached
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Construct a new Autopilot object
|
|
||||||
*
|
|
||||||
* @param moveControl for ManualControl
|
|
||||||
* @param navigation for route instructions
|
|
||||||
*/
|
|
||||||
Autopilot();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroy the Autopilot object
|
* @brief Destroy the Autopilot object
|
||||||
*
|
*
|
||||||
@@ -104,13 +96,13 @@ class Autopilot : public ManualControl {
|
|||||||
void restartLoop();
|
void restartLoop();
|
||||||
void afterActivate() override;
|
void afterActivate() override;
|
||||||
|
|
||||||
Navigation* navigation;
|
Navigation* navigation = nullptr;
|
||||||
CourseCorrection courseCorrection;
|
CourseCorrection courseCorrection{0, 0};
|
||||||
RouteInfo routeInfo;
|
RouteInfo routeInfo{0, 0};
|
||||||
State state = State::None;
|
State state = State::None;
|
||||||
State lastState = State::None;
|
State lastState = State::None;
|
||||||
Navigation::Status lastOrderStatus;
|
Navigation::Status lastOrderStatus;
|
||||||
DirectionChangeSignal* directionChangeSignal;
|
DirectionChangeSignal* directionChangeSignal = nullptr;
|
||||||
|
|
||||||
bool updateDisplay = false;
|
bool updateDisplay = false;
|
||||||
bool loopMode = false;
|
bool loopMode = false;
|
||||||
@@ -119,7 +111,7 @@ class Autopilot : public ManualControl {
|
|||||||
uint16_t autopilotChangeDelayMillis = 500;
|
uint16_t autopilotChangeDelayMillis = 500;
|
||||||
uint32_t lastAutopilotChangeMillis = 0;
|
uint32_t lastAutopilotChangeMillis = 0;
|
||||||
|
|
||||||
int16_t rotationAimAzimuth;
|
int16_t rotationAimAzimuth = 0;
|
||||||
|
|
||||||
double minRemainingDistance = 0.25;
|
double minRemainingDistance = 0.25;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,10 +13,10 @@
|
|||||||
|
|
||||||
|
|
||||||
void CalibrateCompassM::setCalibrateCompass(CalibrateCompass *caliCompass) {
|
void CalibrateCompassM::setCalibrateCompass(CalibrateCompass *caliCompass) {
|
||||||
if (caliCompass) {
|
if (static_cast<bool>(caliCompass)) {
|
||||||
this->caliCompass = caliCompass;
|
this->caliCompass = caliCompass;
|
||||||
this->addChildComponent(this->caliCompass);
|
this->addChildComponent(this->caliCompass);
|
||||||
} else if (this->caliCompass) {
|
} else if (static_cast<bool>(this->caliCompass)) {
|
||||||
this->removeChildComponent(this->caliCompass);
|
this->removeChildComponent(this->caliCompass);
|
||||||
this->caliCompass = caliCompass;
|
this->caliCompass = caliCompass;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,27 +4,32 @@
|
|||||||
* @brief Contains the implementation of the class CaptureRoute
|
* @brief Contains the implementation of the class CaptureRoute
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2022-02-15
|
* @date 2022-02-15
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2022
|
* @copyright Copyright (c) 2022
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "driveModi/Modi/CaptureRoute/captureRoute.h"
|
#include "driveModi/Modi/CaptureRoute/captureRoute.h"
|
||||||
#include "captureRoute.h"
|
#include "captureRoute.h"
|
||||||
|
|
||||||
CaptureRoute::~CaptureRoute() {
|
CaptureRoute::~CaptureRoute()
|
||||||
if (this->navigation)
|
{
|
||||||
delete this->navigation;
|
delete this->navigation;
|
||||||
|
|
||||||
if (this->sensorData->getNtripClient())
|
if (static_cast<bool>(this->sensorData->getNtripClient()))
|
||||||
|
{
|
||||||
this->sensorData->getNtripClient()->setActivated(false);
|
this->sensorData->getNtripClient()->setActivated(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CaptureRoute::run() {
|
void CaptureRoute::run()
|
||||||
|
{
|
||||||
ManualControl::run();
|
ManualControl::run();
|
||||||
if (ControlPadButton::isControlPadButtonPressed(this->input, ControlPadButton::PadButton::Action)) {
|
if (ControlPadButton::isControlPadButtonPressed(this->input, ControlPadButton::PadButton::Action))
|
||||||
|
{
|
||||||
this->status = this->navigation->addCurrentPosToRoute();
|
this->status = this->navigation->addCurrentPosToRoute();
|
||||||
if (this->status == Navigation::Status::Updated) {
|
if (this->status == Navigation::Status::Updated)
|
||||||
|
{
|
||||||
this->lastSavedPoint = this->navigation->getCurrentPosition();
|
this->lastSavedPoint = this->navigation->getCurrentPosition();
|
||||||
this->routeInfo = navigation->getRouteInfo();
|
this->routeInfo = navigation->getRouteInfo();
|
||||||
this->updateDisplay = true;
|
this->updateDisplay = true;
|
||||||
@@ -32,21 +37,27 @@ void CaptureRoute::run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CaptureRoute::afterActivate() {
|
void CaptureRoute::afterActivate()
|
||||||
|
{
|
||||||
this->navigation = new Navigation(this->sensorData);
|
this->navigation = new Navigation(this->sensorData);
|
||||||
this->navigation->getRoute()->clear();
|
this->navigation->getRoute()->clear();
|
||||||
this->sensorData->getNtripClient()->setAutoReconnect(true);
|
this->sensorData->getNtripClient()->setAutoReconnect(true);
|
||||||
this->routeInfo = navigation->getRouteInfo();
|
this->routeInfo = navigation->getRouteInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
double CaptureRoute::getDistanceToLastPoint() const {
|
double CaptureRoute::getDistanceToLastPoint() const
|
||||||
|
{
|
||||||
if (!this->lastSavedPoint.isInit())
|
if (!this->lastSavedPoint.isInit())
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
return this->lastSavedPoint.distanceTo(this->navigation->getCurrentPosition());
|
return this->lastSavedPoint.distanceTo(this->navigation->getCurrentPosition());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CaptureRoute::shouldUpdate() {
|
bool CaptureRoute::shouldUpdate()
|
||||||
if (this->updateDisplay) {
|
{
|
||||||
|
if (this->updateDisplay)
|
||||||
|
{
|
||||||
this->updateDisplay = false;
|
this->updateDisplay = false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,67 +4,89 @@
|
|||||||
* @brief Implementation of the class manualControl.h
|
* @brief Implementation of the class manualControl.h
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2021-12-13
|
* @date 2021-12-13
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2021
|
* @copyright Copyright (c) 2021
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "manualControl.h"
|
#include "manualControl.h"
|
||||||
|
|
||||||
void ManualControl::run() {
|
void ManualControl::run()
|
||||||
switch (this->inputMode) {
|
{
|
||||||
case InputMode::Analog :
|
switch (this->inputMode)
|
||||||
this->analogControl();
|
{
|
||||||
break;
|
case InputMode::Analog:
|
||||||
|
this->analogControl();
|
||||||
|
break;
|
||||||
|
|
||||||
case InputMode::Digital :
|
case InputMode::Digital:
|
||||||
this->digitalControl();
|
this->digitalControl();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControl::switchInputMode() {
|
void ManualControl::switchInputMode()
|
||||||
|
{
|
||||||
this->inputMode = (this->inputMode == InputMode::Analog) ? InputMode::Digital : InputMode::Analog;
|
this->inputMode = (this->inputMode == InputMode::Analog) ? InputMode::Digital : InputMode::Analog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControl::analogControl() {
|
void ManualControl::analogControl()
|
||||||
|
{
|
||||||
// Have to be int16_t to avoid overflow (int8_t = 255 - 127 = -128)
|
// Have to be int16_t to avoid overflow (int8_t = 255 - 127 = -128)
|
||||||
int16_t x = this->input->x - 127;
|
const int16_t xAxis = this->input->x - 127;
|
||||||
int16_t y = this->input->y - 127;
|
const int16_t yAxis = this->input->y - 127;
|
||||||
|
|
||||||
|
|
||||||
double value_per_step = this->maxSpeeds.x * 2 / UINT8_MAX;
|
double value_per_step = this->maxSpeeds.x * 2 / UINT8_MAX;
|
||||||
this->moveControl->setSpeed(-x * value_per_step);
|
this->moveControl->setSpeed(-xAxis * value_per_step);
|
||||||
|
|
||||||
value_per_step = this->maxSpeeds.rot * 2 / UINT8_MAX;
|
value_per_step = this->maxSpeeds.rot * 2 / UINT8_MAX;
|
||||||
this->moveControl->setRotationSpeed(y * value_per_step);
|
this->moveControl->setRotationSpeed(yAxis * value_per_step);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManualControl::digitalControl() {
|
void ManualControl::digitalControl()
|
||||||
int16_t y = this->input->x - 127;
|
{
|
||||||
int16_t x = this->input->y - 127;
|
static constexpr uint8_t deadzone = 120;
|
||||||
|
const int16_t yAxis = this->input->x - 127;
|
||||||
|
const int16_t xAxis = this->input->y - 127;
|
||||||
|
|
||||||
if (y > 120)
|
if (yAxis > deadzone)
|
||||||
|
{
|
||||||
this->moveControl->setSpeed(-this->maxSpeeds.x);
|
this->moveControl->setSpeed(-this->maxSpeeds.x);
|
||||||
else if (y < -120)
|
}
|
||||||
|
else if (yAxis < -deadzone)
|
||||||
|
{
|
||||||
this->moveControl->setSpeed(this->maxSpeeds.rot);
|
this->moveControl->setSpeed(this->maxSpeeds.rot);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
this->moveControl->setSpeed(0);
|
this->moveControl->setSpeed(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (x > 120)
|
if (xAxis > deadzone)
|
||||||
|
{
|
||||||
this->moveControl->setRotationSpeed(this->maxSpeeds.rot);
|
this->moveControl->setRotationSpeed(this->maxSpeeds.rot);
|
||||||
else if (x < -120)
|
}
|
||||||
|
else if (xAxis < -deadzone)
|
||||||
|
{
|
||||||
this->moveControl->setRotationSpeed(-this->maxSpeeds.rot);
|
this->moveControl->setRotationSpeed(-this->maxSpeeds.rot);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
this->moveControl->setRotationSpeed(0);
|
this->moveControl->setRotationSpeed(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (this->directionChangeWrapper && (x > 120 || x < -120))
|
if (static_cast<bool>(this->directionChangeWrapper) && (xAxis > deadzone || xAxis < -deadzone))
|
||||||
|
{
|
||||||
this->lastLoopTurned = true;
|
this->lastLoopTurned = true;
|
||||||
else if (this->lastLoopTurned) {
|
}
|
||||||
if (this->directionChangeWrapper)
|
else if (this->lastLoopTurned)
|
||||||
|
{
|
||||||
|
if (static_cast<bool>(this->directionChangeWrapper))
|
||||||
|
{
|
||||||
this->directionChangeWrapper->action();
|
this->directionChangeWrapper->action();
|
||||||
|
}
|
||||||
this->lastLoopTurned = false;
|
this->lastLoopTurned = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,20 +4,24 @@
|
|||||||
* @brief Contains the implementation of the class TestMode.
|
* @brief Contains the implementation of the class TestMode.
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2022-09-08
|
* @date 2022-09-08
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2022
|
* @copyright Copyright (c) 2022
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "testMode.h"
|
#include "testMode.h"
|
||||||
|
|
||||||
void TestMode::run() {
|
void TestMode::run()
|
||||||
if (this->maneuver == Maneuver::Turn) {
|
{
|
||||||
|
if (this->maneuver == Maneuver::Turn)
|
||||||
|
{
|
||||||
uint16_t delta = abs(this->azimuth - this->getSensorData()->getRealAzimuth());
|
uint16_t delta = abs(this->azimuth - this->getSensorData()->getRealAzimuth());
|
||||||
if (delta > this->degree)
|
if (delta > this->degree) {
|
||||||
this->abort = true;
|
this->abort = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->busy && millis() - this->actionStart > this->maneuverTime || this->abort) {
|
if (this->busy && millis() - this->actionStart > this->maneuverTime || this->abort)
|
||||||
|
{
|
||||||
this->busy = false;
|
this->busy = false;
|
||||||
this->abort = false;
|
this->abort = false;
|
||||||
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
||||||
@@ -25,62 +29,76 @@ void TestMode::run() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestMode::drive(int16_t cm, int16_t degree) {
|
bool TestMode::drive(int16_t cmDistance, int16_t degree)
|
||||||
if (this->busy)
|
{
|
||||||
|
if (this->busy){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
this->actionStart = millis();
|
this->actionStart = millis();
|
||||||
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
||||||
|
|
||||||
if (cm == 0) {
|
if (cmDistance == 0)
|
||||||
//Only left or right
|
{
|
||||||
|
// Only left or right
|
||||||
this->moveControl->setSpeed(0);
|
this->moveControl->setSpeed(0);
|
||||||
|
|
||||||
if (degree < 0)
|
if (degree < 0){
|
||||||
this->moveControl->setRotationSpeed(-this->maxSpeeds.rot);
|
this->moveControl->setRotationSpeed(-this->maxSpeeds.rot);
|
||||||
else if (degree > 0)
|
}
|
||||||
|
else if (degree > 0){
|
||||||
this->moveControl->setRotationSpeed(this->maxSpeeds.rot);
|
this->moveControl->setRotationSpeed(this->maxSpeeds.rot);
|
||||||
|
}
|
||||||
|
|
||||||
this->azimuth = this->getSensorData()->getRealAzimuth();
|
this->azimuth = this->getSensorData()->getRealAzimuth();
|
||||||
this->degree = degree;
|
this->degree = degree;
|
||||||
|
|
||||||
this->maneuverTime = 5 * 1000;
|
this->maneuverTime = 5 * 1000;
|
||||||
this->busy = true;
|
this->busy = true;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
} else if (degree == 0) {
|
if (degree == 0)
|
||||||
//Only forward or backward
|
{
|
||||||
|
// Only forward or backward
|
||||||
this->moveControl->setRotationSpeed(0);
|
this->moveControl->setRotationSpeed(0);
|
||||||
|
|
||||||
if (cm < 0)
|
if (cmDistance < 0){
|
||||||
this->moveControl->setSpeed(-this->maxSpeeds.x);
|
this->moveControl->setSpeed(-this->maxSpeeds.x);
|
||||||
else if (cm > 0)
|
}
|
||||||
|
else if (cmDistance > 0){
|
||||||
this->moveControl->setSpeed(this->maxSpeeds.x);
|
this->moveControl->setSpeed(this->maxSpeeds.x);
|
||||||
|
}
|
||||||
this->maneuverTime = (uint32_t) (((double) abs(cm) / 100.0) / this->maxSpeeds.x) * 1000;
|
|
||||||
|
this->maneuverTime = static_cast<uint32_t>(((abs(cmDistance) / 100.0) / this->maxSpeeds.x) * 1000);
|
||||||
this->busy = true;
|
this->busy = true;
|
||||||
this->maneuver = Maneuver::Drive;
|
this->maneuver = Maneuver::Drive;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
}
|
||||||
//forward or backward and left or right
|
else
|
||||||
// TODO: Calculate roationspeed
|
{
|
||||||
if (cm < 0)
|
// forward or backward and left or right
|
||||||
|
// TODO: Calculate roationspeed
|
||||||
|
if (cmDistance < 0){
|
||||||
this->moveControl->setSpeed(-this->maxSpeeds.x);
|
this->moveControl->setSpeed(-this->maxSpeeds.x);
|
||||||
else if (cm > 0)
|
}
|
||||||
|
else if (cmDistance > 0){
|
||||||
this->moveControl->setSpeed(this->maxSpeeds.x);
|
this->moveControl->setSpeed(this->maxSpeeds.x);
|
||||||
|
}
|
||||||
this->maneuverTime = (uint32_t) (((double) cm / 100.0) / this->maxSpeeds.x) * 1000;
|
|
||||||
|
this->maneuverTime = static_cast<uint32_t>(((cmDistance / 100.0) / this->maxSpeeds.x) * 1000);
|
||||||
this->busy = true;
|
this->busy = true;
|
||||||
this->maneuver = Maneuver::Drive;
|
this->maneuver = Maneuver::Drive;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestMode::leftEngine(int16_t powerPercentage, int16_t seconds) {
|
bool TestMode::leftEngine(int16_t powerPercentage, int16_t seconds)
|
||||||
if (this->engineInit(powerPercentage, seconds)) {
|
{
|
||||||
|
if (this->engineInit(powerPercentage, seconds))
|
||||||
|
{
|
||||||
this->moveControl->setRawPowerLeft(powerPercentage);
|
this->moveControl->setRawPowerLeft(powerPercentage);
|
||||||
this->maneuver = Maneuver::LeftEngine;
|
this->maneuver = Maneuver::LeftEngine;
|
||||||
std::cout << "TestMode::leftEngine" << std::endl;
|
std::cout << "TestMode::leftEngine" << std::endl;
|
||||||
@@ -89,8 +107,10 @@ bool TestMode::leftEngine(int16_t powerPercentage, int16_t seconds) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestMode::rightEngine(int16_t powerPercentage, int16_t seconds) {
|
bool TestMode::rightEngine(int16_t powerPercentage, int16_t seconds)
|
||||||
if (this->engineInit(powerPercentage, seconds)) {
|
{
|
||||||
|
if (this->engineInit(powerPercentage, seconds))
|
||||||
|
{
|
||||||
this->moveControl->setRawPowerRight(powerPercentage);
|
this->moveControl->setRawPowerRight(powerPercentage);
|
||||||
this->maneuver = Maneuver::RightEngine;
|
this->maneuver = Maneuver::RightEngine;
|
||||||
return true;
|
return true;
|
||||||
@@ -98,8 +118,10 @@ bool TestMode::rightEngine(int16_t powerPercentage, int16_t seconds) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestMode::bothEngine(int16_t powerPercentage, int16_t seconds) {
|
bool TestMode::bothEngine(int16_t powerPercentage, int16_t seconds)
|
||||||
if (this->engineInit(powerPercentage, seconds)) {
|
{
|
||||||
|
if (this->engineInit(powerPercentage, seconds))
|
||||||
|
{
|
||||||
this->moveControl->setRawPowerLeft(powerPercentage);
|
this->moveControl->setRawPowerLeft(powerPercentage);
|
||||||
this->moveControl->setRawPowerRight(powerPercentage);
|
this->moveControl->setRawPowerRight(powerPercentage);
|
||||||
this->maneuver = Maneuver::BothEngine;
|
this->maneuver = Maneuver::BothEngine;
|
||||||
@@ -108,23 +130,30 @@ bool TestMode::bothEngine(int16_t powerPercentage, int16_t seconds) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestMode::abortManeuver() {
|
void TestMode::abortManeuver()
|
||||||
|
{
|
||||||
this->abort = true;
|
this->abort = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t TestMode::getRemainingManeuverTime() const {
|
uint8_t TestMode::getRemainingManeuverTime() const
|
||||||
if (this->busy)
|
{
|
||||||
return (uint8_t) ((this->maneuverTime - (millis() - this->actionStart)) / 1000);
|
if (this->busy){
|
||||||
|
return static_cast<uint8_t>((this->maneuverTime - (millis() - this->actionStart)) / 1000);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestMode::engineInit(int16_t powerPercentage, int16_t seconds) {
|
bool TestMode::engineInit(int16_t powerPercentage, int16_t seconds)
|
||||||
if (this->busy)
|
{
|
||||||
|
if (this->busy){
|
||||||
return false;
|
return false;
|
||||||
if (powerPercentage > 100 || powerPercentage < -100)
|
}
|
||||||
|
if (powerPercentage > TestMode::maxPercentage || powerPercentage < -TestMode::maxPercentage){
|
||||||
return false;
|
return false;
|
||||||
if (seconds < 0)
|
}
|
||||||
|
if (seconds < 0){
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
this->actionStart = millis();
|
this->actionStart = millis();
|
||||||
this->moveControl->setDrivingStatus(MoveControl::Status::Raw);
|
this->moveControl->setDrivingStatus(MoveControl::Status::Raw);
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
* @brief Contains a class to test different functions from the rover.
|
* @brief Contains a class to test different functions from the rover.
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2022-09-08
|
* @date 2022-09-08
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2022
|
* @copyright Copyright (c) 2022
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef TEST_MODE_H
|
#ifndef TEST_MODE_H
|
||||||
#define TEST_MODE_H
|
#define TEST_MODE_H
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -16,97 +16,100 @@
|
|||||||
#include "moveControl.h"
|
#include "moveControl.h"
|
||||||
#include "driveModi/driveModi.h"
|
#include "driveModi/driveModi.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Test different functions from the rover.
|
* @brief Test different functions from the rover.
|
||||||
*
|
*
|
||||||
* You can test engine, engine controller, light and speed meter.
|
* You can test engine, engine controller, light and speed meter.
|
||||||
*/
|
*/
|
||||||
class TestMode : public DriveModi {
|
class TestMode : public DriveModi
|
||||||
public:
|
{
|
||||||
/**
|
public:
|
||||||
* @brief Different states to test the engine
|
/**
|
||||||
*
|
* @brief Different states to test the engine
|
||||||
*/
|
*
|
||||||
enum Maneuver {
|
*/
|
||||||
None,
|
enum Maneuver
|
||||||
LeftEngine,
|
{
|
||||||
RightEngine,
|
None,
|
||||||
BothEngine,
|
LeftEngine,
|
||||||
Turn,
|
RightEngine,
|
||||||
Drive
|
BothEngine,
|
||||||
};
|
Turn,
|
||||||
|
Drive
|
||||||
|
};
|
||||||
|
|
||||||
bool drive(int16_t cm = 0, int16_t degree = 0);
|
bool drive(int16_t cmDistance = 0, int16_t degree = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Sets the left Engine to a specific power value.
|
* @brief Sets the left Engine to a specific power value.
|
||||||
*
|
*
|
||||||
* This start a maneuver with the given time.
|
* This start a maneuver with the given time.
|
||||||
*
|
*
|
||||||
* @param powerPercentage from 0% to 100%
|
* @param powerPercentage from 0% to 100%
|
||||||
* @param seconds time to run the engine
|
* @param seconds time to run the engine
|
||||||
* @return true success
|
* @return true success
|
||||||
* @return false failure
|
* @return false failure
|
||||||
*/
|
*/
|
||||||
bool leftEngine(int16_t powerPercentage, int16_t seconds);
|
bool leftEngine(int16_t powerPercentage, int16_t seconds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief See leftEngine
|
* @brief See leftEngine
|
||||||
*
|
*
|
||||||
* @param powerPercentage
|
* @param powerPercentage
|
||||||
* @param seconds
|
* @param seconds
|
||||||
* @return true
|
* @return true
|
||||||
* @return false
|
* @return false
|
||||||
*/
|
*/
|
||||||
bool rightEngine(int16_t powerPercentage, int16_t seconds);
|
bool rightEngine(int16_t powerPercentage, int16_t seconds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief See leftEngine
|
* @brief See leftEngine
|
||||||
*
|
*
|
||||||
* @param powerPercentage
|
* @param powerPercentage
|
||||||
* @param seconds
|
* @param seconds
|
||||||
* @return true
|
* @return true
|
||||||
* @return false
|
* @return false
|
||||||
*/
|
*/
|
||||||
bool bothEngine(int16_t powerPercentage, int16_t seconds);
|
bool bothEngine(int16_t powerPercentage, int16_t seconds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Abort the running maneuver.
|
* @brief Abort the running maneuver.
|
||||||
*
|
*
|
||||||
* Stops all movement. This is the only possibility to cancel a maneuver
|
* Stops all movement. This is the only possibility to cancel a maneuver
|
||||||
* before the time is up.
|
* before the time is up.
|
||||||
*/
|
*/
|
||||||
void abortManeuver();
|
void abortManeuver();
|
||||||
|
|
||||||
uint8_t getRemainingManeuverTime() const;
|
uint8_t getRemainingManeuverTime() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns true if a maneuver is running
|
* @brief Returns true if a maneuver is running
|
||||||
*
|
*
|
||||||
* @return true
|
* @return true
|
||||||
* @return false
|
* @return false
|
||||||
*/
|
*/
|
||||||
bool getBusy() const { return this->busy; }
|
bool getBusy() const { return this->busy; }
|
||||||
Maneuver getManeuver() const { return this->maneuver; }
|
Maneuver getManeuver() const { return this->maneuver; }
|
||||||
Speedometer* getSpeedometerLeft() const { return this->moveControl->getSpeedometerLeft(); }
|
Speedometer *getSpeedometerLeft() const { return this->moveControl->getSpeedometerLeft(); }
|
||||||
Speedometer* getSpeedometerRight() const { return this->moveControl->getSpeedometerRight(); }
|
Speedometer *getSpeedometerRight() const { return this->moveControl->getSpeedometerRight(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void run() override;
|
void run() override;
|
||||||
bool engineInit(int16_t powerPercentage, int16_t seconds);
|
bool engineInit(int16_t powerPercentage, int16_t seconds);
|
||||||
|
|
||||||
Maneuver maneuver = Maneuver::None;
|
Maneuver maneuver = Maneuver::None;
|
||||||
int16_t maneuverValueOne = 0;
|
int16_t maneuverValueOne = 0;
|
||||||
int16_t maneuverValueTwo = 0;
|
int16_t maneuverValueTwo = 0;
|
||||||
|
|
||||||
bool busy = false;
|
bool busy = false;
|
||||||
bool abort = false;
|
bool abort = false;
|
||||||
|
|
||||||
uint16_t azimuth;
|
uint16_t azimuth;
|
||||||
int16_t degree;
|
int16_t degree;
|
||||||
uint32_t maneuverTime = 0;
|
uint32_t maneuverTime = 0;
|
||||||
uint32_t actionStart = 0;
|
uint32_t actionStart = 0;
|
||||||
|
|
||||||
|
static constexpr int8_t maxPercentage = 100;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TEST_MODE_H
|
#endif // TEST_MODE_H
|
||||||
|
|||||||
@@ -4,44 +4,46 @@
|
|||||||
* @brief Implementation of the class DriveManager
|
* @brief Implementation of the class DriveManager
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2021-12-14
|
* @date 2021-12-14
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2021
|
* @copyright Copyright (c) 2021
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "driveModi/driveManager.h"
|
#include "driveModi/driveManager.h"
|
||||||
|
|
||||||
DriveManager::DriveManager(MoveControl *moveControl, const SensorData* sensorData, const ControlPadInput *input) {
|
DriveManager::DriveManager(MoveControl *moveControl, const SensorData *sensorData, const ControlPadInput *input)
|
||||||
this->driveModiParams.input = input;
|
: driveModiParams{moveControl, input, sensorData}
|
||||||
this->driveModiParams.moveControl = moveControl;
|
{
|
||||||
this->driveModiParams.sensorData = sensorData;
|
|
||||||
|
|
||||||
this->init();
|
this->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
DriveManager::DriveManager(DriveModiParams params){
|
DriveManager::DriveManager(DriveModiParams params)
|
||||||
this->driveModiParams = params;
|
: driveModiParams{params}
|
||||||
|
{
|
||||||
this->init();
|
this->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriveManager::changeModus(DriveModi* modus) {
|
void DriveManager::changeModus(DriveModi *modus)
|
||||||
if (this->currentModusPtr) {
|
{
|
||||||
|
if (static_cast<bool>(this->currentModusPtr))
|
||||||
|
{
|
||||||
this->removeChildComponent(this->currentModusPtr);
|
this->removeChildComponent(this->currentModusPtr);
|
||||||
delete this->currentModusPtr;
|
delete this->currentModusPtr;
|
||||||
this->currentModusPtr = nullptr;
|
this->currentModusPtr = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->currentModusPtr = modus;
|
this->currentModusPtr = modus;
|
||||||
|
|
||||||
if (this->currentModusPtr) {
|
if (static_cast<bool>(this->currentModusPtr))
|
||||||
|
{
|
||||||
this->currentModusPtr->activate(this->driveModiParams);
|
this->currentModusPtr->activate(this->driveModiParams);
|
||||||
this->currentModusPtr->setSpeeds(this->drivingSpeeds);
|
this->currentModusPtr->setSpeeds(this->drivingSpeeds);
|
||||||
this->addChildComponent(this->currentModusPtr);
|
this->addChildComponent(this->currentModusPtr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DriveManager::init() {
|
void DriveManager::init()
|
||||||
|
{
|
||||||
this->addChildComponent(this->driveModiParams.moveControl);
|
this->addChildComponent(this->driveModiParams.moveControl);
|
||||||
this->activateOnlyChilds();
|
this->activateOnlyChilds();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
#include "driveModi.h"
|
#include "driveModi.h"
|
||||||
|
|
||||||
DriveModi::DriveModi() {
|
|
||||||
this->loopDelay = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
DriveModi::~DriveModi() {
|
DriveModi::~DriveModi() {
|
||||||
this->moveControl->setSpeed(0);
|
this->moveControl->setSpeed(0);
|
||||||
this->moveControl->setRotationSpeed(0);
|
this->moveControl->setRotationSpeed(0);
|
||||||
@@ -26,6 +22,6 @@ void DriveModi::activate(DriveModiParams params){
|
|||||||
|
|
||||||
void DriveModi::init() {
|
void DriveModi::init() {
|
||||||
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
||||||
this->loopDelay = 40;
|
this->loopDelay = DriveModi::defaultDelay;
|
||||||
this->afterActivate();
|
this->afterActivate();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ struct DriveModiParams {
|
|||||||
*/
|
*/
|
||||||
class DriveModi : public Component {
|
class DriveModi : public Component {
|
||||||
public:
|
public:
|
||||||
DriveModi();
|
|
||||||
virtual ~DriveModi();
|
virtual ~DriveModi();
|
||||||
|
|
||||||
const SensorData* getSensorData() const { return this->sensorData; }
|
const SensorData* getSensorData() const { return this->sensorData; }
|
||||||
@@ -46,12 +45,14 @@ class DriveModi : public Component {
|
|||||||
protected:
|
protected:
|
||||||
virtual void afterActivate() {}
|
virtual void afterActivate() {}
|
||||||
|
|
||||||
MoveControl *moveControl;
|
MoveControl *moveControl = nullptr;
|
||||||
DrivingSpeeds maxSpeeds = {1, 7};
|
DrivingSpeeds maxSpeeds = {1, 7};
|
||||||
const ControlPadInput* input;
|
const ControlPadInput* input = nullptr;
|
||||||
const SensorData* sensorData;
|
const SensorData* sensorData = nullptr;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
|
||||||
|
static constexpr uint8_t defaultDelay = 40;
|
||||||
};
|
};
|
||||||
#endif // DRIVEMODI_H
|
#endif // DRIVEMODI_H
|
||||||
|
|||||||
+157
-99
@@ -2,15 +2,15 @@
|
|||||||
* @file main.cpp
|
* @file main.cpp
|
||||||
* @author Alexander Klein (alex@kleiax.de)
|
* @author Alexander Klein (alex@kleiax.de)
|
||||||
* @brief The main file.
|
* @brief The main file.
|
||||||
*
|
*
|
||||||
* Sets up Network stuff, PS3-Controller, Menu and Lcd
|
* Sets up Network stuff, PS3-Controller, Menu and Lcd
|
||||||
* Handles Controller Input
|
* Handles Controller Input
|
||||||
*
|
*
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2022-02-15
|
* @date 2022-02-15
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2022
|
* @copyright Copyright (c) 2022
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
@@ -50,61 +50,71 @@
|
|||||||
#include "SpecialMenus/CalibrateBattery/menuCalibrateBattery.h"
|
#include "SpecialMenus/CalibrateBattery/menuCalibrateBattery.h"
|
||||||
|
|
||||||
MoveControl moveController;
|
MoveControl moveController;
|
||||||
Network* network;
|
Network *network;
|
||||||
DriveManager* driveManager;
|
DriveManager *driveManager;
|
||||||
Menu* main_m;
|
Menu *main_m;
|
||||||
LiquidCrystal_I2C* lcd;
|
LiquidCrystal_I2C *lcd;
|
||||||
LcdWrapper* lcdWrapper;
|
LcdWrapper *lcdWrapper;
|
||||||
OutputBuf* outputBuf;
|
OutputBuf *outputBuf;
|
||||||
DebugMqtt* debugMqtt = nullptr;
|
DebugMqtt *debugMqtt = nullptr;
|
||||||
Battery* mainBattery;
|
Battery *mainBattery;
|
||||||
SPIClass* spiPort;
|
SPIClass *spiPort;
|
||||||
SensorData* sensorData;
|
SensorData *sensorData;
|
||||||
ControlPad* controlPad;
|
ControlPad *controlPad;
|
||||||
|
|
||||||
bool wifiIsActive;
|
constexpr uint16_t displayUpdateDelay = 500;
|
||||||
|
|
||||||
void i2cScanner(void);
|
void i2cScanner();
|
||||||
void makeMenu(void);
|
void makeMenu();
|
||||||
void restart(void);
|
void restart();
|
||||||
void receiveCallback (const uint8_t * mac, const uint8_t *incomingData, int len);
|
void receiveCallback(const uint8_t *mac, const uint8_t *incomingData, int len);
|
||||||
void sendCallback (const uint8_t *mac_addr, esp_now_send_status_t status);
|
void sendCallback(const uint8_t *mac_addr, esp_now_send_status_t status);
|
||||||
void lcdWrapperCallback (const char data[][LcdWrapper::totalRows], uint8_t lines, uint8_t rows);
|
void lcdWrapperCallback(const char data[][LcdWrapper::totalRows], uint8_t lines, uint8_t rows);
|
||||||
NetworkAdresses setIPs(void);
|
NetworkAdresses setIPs();
|
||||||
|
|
||||||
|
void setup()
|
||||||
void setup() {
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(Settings::baudRate);
|
||||||
// DebugTimes::setConsolOutput(true);
|
// DebugTimes::setConsolOutput(true);
|
||||||
DebugTimes setupTime;
|
DebugTimes setupTime;
|
||||||
|
|
||||||
spiPort = new SPIClass(HSPI);
|
spiPort = new SPIClass(HSPI);
|
||||||
spiPort->begin(PinNumbers::spiSck, PinNumbers::spiCipo, PinNumbers::spiCopi, PinNumbers::gnssSpiCs);
|
spiPort->begin(PinNumbers::spiSck, PinNumbers::spiCipo, PinNumbers::spiCopi, PinNumbers::gnssSpiCs);
|
||||||
|
|
||||||
mainBattery = new Battery(35);
|
mainBattery = new Battery(PinNumbers::battery);
|
||||||
controlPad = new ControlPad();
|
controlPad = new ControlPad();
|
||||||
|
|
||||||
Wire.begin(21, 19);
|
Wire.begin(PinNumbers::sda, PinNumbers::scl);
|
||||||
Wire.setClock(400000);
|
Wire.setClock(Settings::i2cSpeed);
|
||||||
i2cScanner();
|
i2cScanner();
|
||||||
lcd = new LiquidCrystal_I2C(0x3F,16,2);
|
lcd = new LiquidCrystal_I2C(0x3F, 16, 2);
|
||||||
lcd->init();
|
lcd->init();
|
||||||
lcd->clear();
|
lcd->clear();
|
||||||
lcd->noBacklight();
|
lcd->noBacklight();
|
||||||
|
|
||||||
network = new Network(NetworkConfig::ssid, NetworkConfig::password, setIPs());
|
network = new Network(static_cast<const char*>(NetworkConfig::ssid),
|
||||||
|
static_cast<const char*>(NetworkConfig::password),
|
||||||
|
setIPs());
|
||||||
network->activateEspNow(receiveCallback, sendCallback);
|
network->activateEspNow(receiveCallback, sendCallback);
|
||||||
if (NetworkConfig::mqtt) {
|
if (NetworkConfig::mqtt)
|
||||||
if (network->activateMqtt(MqttConfig::user, MqttConfig::password)) {
|
{
|
||||||
|
if (network->activateMqtt(static_cast<const char*>(MqttConfig::user),
|
||||||
|
static_cast<const char*>(MqttConfig::password)))
|
||||||
|
{
|
||||||
DebugMqtt::init(network->getMqttClient(), Loglevel::debug);
|
DebugMqtt::init(network->getMqttClient(), Loglevel::debug);
|
||||||
debugMqtt = new DebugMqtt("Console");
|
debugMqtt = new DebugMqtt("Console");
|
||||||
outputBuf = new OutputBuf(debugMqtt);
|
outputBuf = new OutputBuf(debugMqtt);
|
||||||
outputBuf->activateMqtt(true);
|
outputBuf->activateMqtt(true);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
outputBuf = new OutputBuf();
|
outputBuf = new OutputBuf();
|
||||||
}
|
}
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
outputBuf = new OutputBuf();
|
outputBuf = new OutputBuf();
|
||||||
|
}
|
||||||
std::cout.rdbuf(outputBuf);
|
std::cout.rdbuf(outputBuf);
|
||||||
|
|
||||||
std::cout << "Welcome to Kleiax-Rover" << std::endl;
|
std::cout << "Welcome to Kleiax-Rover" << std::endl;
|
||||||
@@ -115,13 +125,19 @@ void setup() {
|
|||||||
sensorData = new SensorData();
|
sensorData = new SensorData();
|
||||||
sensorData->enableGnss(spiPort, PinNumbers::gnssSpiCs);
|
sensorData->enableGnss(spiPort, PinNumbers::gnssSpiCs);
|
||||||
sensorData->enableRealCompass();
|
sensorData->enableRealCompass();
|
||||||
sensorData->enableNtrip(NtripConfig::host, NtripConfig::port, NtripConfig::mountPoint, NtripConfig::user, NtripConfig::password);
|
sensorData->enableNtrip(static_cast<const char*>(NtripConfig::host),
|
||||||
|
NtripConfig::port,
|
||||||
|
static_cast<const char*>(NtripConfig::mountPoint),
|
||||||
|
static_cast<const char*>(NtripConfig::user),
|
||||||
|
static_cast<const char*>(NtripConfig::password));
|
||||||
// sensorData->enableGyroskop();
|
// sensorData->enableGyroskop();
|
||||||
driveManager = new DriveManager(&moveController, sensorData, controlPad->getControlPadDataPtr());
|
driveManager = new DriveManager(&moveController, sensorData, controlPad->getControlPadDataPtr());
|
||||||
|
|
||||||
char wifiIndicator = 'X';
|
char wifiIndicator = 'X';
|
||||||
if (network->isWifiConnected())
|
if (network->isWifiConnected())
|
||||||
|
{
|
||||||
wifiIndicator = '-';
|
wifiIndicator = '-';
|
||||||
|
}
|
||||||
lcd->backlight();
|
lcd->backlight();
|
||||||
lcd->printf("%c Kleiax-Rover %c", wifiIndicator, wifiIndicator);
|
lcd->printf("%c Kleiax-Rover %c", wifiIndicator, wifiIndicator);
|
||||||
lcd->setCursor(0, 1);
|
lcd->setCursor(0, 1);
|
||||||
@@ -134,7 +150,8 @@ void setup() {
|
|||||||
setupTime.stopConsol("Setup");
|
setupTime.stopConsol("Setup");
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop()
|
||||||
|
{
|
||||||
network->loop();
|
network->loop();
|
||||||
sensorData->loop();
|
sensorData->loop();
|
||||||
driveManager->loop();
|
driveManager->loop();
|
||||||
@@ -143,86 +160,113 @@ void loop() {
|
|||||||
lcdWrapper->loop();
|
lcdWrapper->loop();
|
||||||
mainBattery->loop();
|
mainBattery->loop();
|
||||||
|
|
||||||
// new Value ervery 0.5s
|
// new Value ervery 0.5s
|
||||||
if (mainBattery->isNewValue()) {
|
if (mainBattery->isNewValue())
|
||||||
|
{
|
||||||
static uint8_t batteryLowCounter = 0;
|
static uint8_t batteryLowCounter = 0;
|
||||||
if (mainBattery->isBatteryLow(10))
|
static constexpr uint8_t minVoltage = 10;
|
||||||
|
if (mainBattery->isBatteryLow(minVoltage))
|
||||||
|
{
|
||||||
batteryLowCounter++;
|
batteryLowCounter++;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
batteryLowCounter = 0;
|
batteryLowCounter = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (batteryLowCounter >= 10) {
|
if (batteryLowCounter >= 10)
|
||||||
|
{
|
||||||
moveController.emergencyStop();
|
moveController.emergencyStop();
|
||||||
uint16_t voltage = (uint16_t) (mainBattery->getBatteryVoltage() * 100);
|
const auto voltage = static_cast<uint16_t>(mainBattery->getBatteryVoltage() * 100);
|
||||||
lcd->setCursor(0, 0);
|
lcd->setCursor(0, 0);
|
||||||
lcd->printf("Low Battery: %u", voltage);
|
lcd->printf("Low Battery: %u", voltage);
|
||||||
lcd->setCursor(0, 1);
|
lcd->setCursor(0, 1);
|
||||||
lcd->print("Please turn off.");
|
lcd->print("Please turn off.");
|
||||||
|
|
||||||
while (true);
|
while (true)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void i2cScanner() {
|
void i2cScanner()
|
||||||
|
{
|
||||||
|
constexpr uint8_t checkForLength = 16;
|
||||||
|
constexpr uint8_t maxAdresses = UINT8_MAX / 2;
|
||||||
std::cout << "\nI2C Scanner" << std::endl;
|
std::cout << "\nI2C Scanner" << std::endl;
|
||||||
|
|
||||||
byte error, address;
|
byte error = 0;
|
||||||
int nDevices;
|
byte address = 0;
|
||||||
|
int nDevices = 0;
|
||||||
std::cout << "Scanning..." << std::endl;
|
std::cout << "Scanning..." << std::endl;
|
||||||
nDevices = 0;
|
for (address = 1; address < maxAdresses; address++)
|
||||||
for(address = 1; address < 127; address++ ) {
|
{
|
||||||
Wire.beginTransmission(address);
|
Wire.beginTransmission(address);
|
||||||
error = Wire.endTransmission();
|
error = Wire.endTransmission();
|
||||||
if (error == 0) {
|
if (error == 0)
|
||||||
|
{
|
||||||
std::cout << "I2C device found at address 0x";
|
std::cout << "I2C device found at address 0x";
|
||||||
if (address<16)
|
if (address < checkForLength)
|
||||||
|
{
|
||||||
std::cout << "0";
|
std::cout << "0";
|
||||||
std::cout << std::hex << (int) address << std::dec << std::endl;
|
}
|
||||||
|
std::cout << std::hex << static_cast<int>(address) << std::dec << std::endl;
|
||||||
// std::cout << (int) address << std::endl;
|
// std::cout << (int) address << std::endl;
|
||||||
nDevices++;
|
nDevices++;
|
||||||
}
|
}
|
||||||
else if (error==4) {
|
else if (error == 4)
|
||||||
|
{
|
||||||
std::cout << "Unknow error at address 0x";
|
std::cout << "Unknow error at address 0x";
|
||||||
if (address<16)
|
if (address < checkForLength)
|
||||||
|
{
|
||||||
std::cout << "0";
|
std::cout << "0";
|
||||||
std::cout << std::hex << (int) address << std::dec << std::endl;
|
}
|
||||||
}
|
std::cout << std::hex << static_cast<int>(address) << std::dec << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (nDevices == 0)
|
if (nDevices == 0)
|
||||||
std::cout << "No I2C devices found\n" << std::endl;
|
{
|
||||||
|
std::cout << "No I2C devices found\n"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
std::cout << "done\n" << std::endl;
|
{
|
||||||
|
std::cout << "done\n"
|
||||||
|
<< std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void makeMenu() {
|
void makeMenu()
|
||||||
auto dummy = []() {
|
{
|
||||||
std::cout << "Dummy in Action" <<std::endl;
|
auto dummy = []()
|
||||||
|
{
|
||||||
|
std::cout << "Dummy in Action" << std::endl;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create Menu
|
// Create Menu
|
||||||
main_m = new Menu();
|
main_m = new Menu();
|
||||||
main_m->setLcd(lcdWrapper);
|
main_m->setLcd(lcdWrapper);
|
||||||
auto mode_m = new Menu();
|
auto *mode_m = new Menu();
|
||||||
auto set_m = new Menu();
|
auto *set_m = new Menu();
|
||||||
auto pid_m = new Menu();
|
auto *pid_m = new Menu();
|
||||||
auto pidl_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(0)));
|
auto *pidl_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(0)));
|
||||||
auto pidr_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(1)));
|
auto *pidr_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(1)));
|
||||||
auto speed_m = new MenuIntInput(2, new MenuSpeed(driveManager->getDrivingSpeedsRef()));
|
auto *speed_m = new MenuIntInput(2, new MenuSpeed(driveManager->getDrivingSpeedsRef()));
|
||||||
auto man_m = new MenuManualControl(driveManager);
|
auto *man_m = new MenuManualControl(driveManager);
|
||||||
auto cap_m = new MenuCaptureRoute(driveManager);
|
auto *cap_m = new MenuCaptureRoute(driveManager);
|
||||||
auto auto_m = new MenuAutopilot(driveManager);
|
auto *auto_m = new MenuAutopilot(driveManager);
|
||||||
auto testM_m = new MenuTestMode(driveManager);
|
auto *testM_m = new MenuTestMode(driveManager);
|
||||||
auto comp_m = new MenuCalibrateCompass(driveManager);
|
auto *comp_m = new MenuCalibrateCompass(driveManager);
|
||||||
auto sys_m = new MenuSysteminformation(mainBattery);
|
auto *sys_m = new MenuSysteminformation(mainBattery);
|
||||||
auto sen_m = new MenuSensorData(sensorData);
|
auto *sen_m = new MenuSensorData(sensorData);
|
||||||
//TODO: Wie bekommt jeder die dumme Route?
|
// TODO: Wie bekommt jeder die dumme Route?
|
||||||
auto rout_m = new MenuRoute(new Route());
|
auto *rout_m = new MenuRoute(new Route());
|
||||||
auto bat_m = new MenuCalibrateBattery(mainBattery);
|
auto *bat_m = new MenuCalibrateBattery(mainBattery);
|
||||||
|
|
||||||
auto_m->setUpdateDelay(1000);
|
auto_m->setUpdateDelay(displayUpdateDelay);
|
||||||
sys_m->setUpdateDelay(1500);
|
sys_m->setUpdateDelay(displayUpdateDelay);
|
||||||
sen_m->setUpdateDelay(500);
|
sen_m->setUpdateDelay(displayUpdateDelay);
|
||||||
|
|
||||||
// Entry for the main menu
|
// Entry for the main menu
|
||||||
main_m->addEntry(new MenuAction("Mode", mode_m));
|
main_m->addEntry(new MenuAction("Mode", mode_m));
|
||||||
@@ -253,14 +297,14 @@ void makeMenu() {
|
|||||||
|
|
||||||
// Other config
|
// Other config
|
||||||
pidl_m->setMinMax(0, UINT8_MAX);
|
pidl_m->setMinMax(0, UINT8_MAX);
|
||||||
pidl_m->setEntry(0, "P-Part", (uint8_t) moveController.getPID(0)->GetKp());
|
pidl_m->setEntry(0, "P-Part", static_cast<uint8_t>(moveController.getPID(0)->GetKp()));
|
||||||
pidl_m->setEntry(1, "I-Part", (uint8_t) moveController.getPID(0)->GetKi());
|
pidl_m->setEntry(1, "I-Part", static_cast<uint8_t>(moveController.getPID(0)->GetKi()));
|
||||||
pidl_m->setEntry(2, "D-Part", (uint8_t) moveController.getPID(0)->GetKd());
|
pidl_m->setEntry(2, "D-Part", static_cast<uint8_t>(moveController.getPID(0)->GetKd()));
|
||||||
|
|
||||||
pidr_m->setMinMax(0, UINT8_MAX);
|
pidr_m->setMinMax(0, UINT8_MAX);
|
||||||
pidr_m->setEntry(0, "P-Part", (uint8_t) moveController.getPID(1)->GetKp());
|
pidr_m->setEntry(0, "P-Part", static_cast<uint8_t>(moveController.getPID(1)->GetKp()));
|
||||||
pidr_m->setEntry(1, "I-Part", (uint8_t) moveController.getPID(1)->GetKi());
|
pidr_m->setEntry(1, "I-Part", static_cast<uint8_t>(moveController.getPID(1)->GetKi()));
|
||||||
pidr_m->setEntry(2, "D-Part", (uint8_t) moveController.getPID(1)->GetKd());
|
pidr_m->setEntry(2, "D-Part", static_cast<uint8_t>(moveController.getPID(1)->GetKd()));
|
||||||
|
|
||||||
speed_m->setMinMax(5, UINT8_MAX);
|
speed_m->setMinMax(5, UINT8_MAX);
|
||||||
speed_m->setEntry(0, "x m/s e-1", driveManager->getDrivingSpeedsRef().x * 10);
|
speed_m->setEntry(0, "x m/s e-1", driveManager->getDrivingSpeedsRef().x * 10);
|
||||||
@@ -271,42 +315,56 @@ void makeMenu() {
|
|||||||
controlPad->setMenuControl(main_m);
|
controlPad->setMenuControl(main_m);
|
||||||
}
|
}
|
||||||
|
|
||||||
void restart() {
|
void restart()
|
||||||
|
{
|
||||||
lcdWrapper->clear();
|
lcdWrapper->clear();
|
||||||
lcdWrapper->setCursor(0, 0);
|
lcdWrapper->setCursor(0, 0);
|
||||||
lcdWrapper->print("Rebooting ...");
|
lcdWrapper->print("Rebooting ...");
|
||||||
ESP.restart();
|
ESP.restart();
|
||||||
}
|
}
|
||||||
|
|
||||||
void receiveCallback (const uint8_t * mac, const uint8_t *incomingData, int len) {
|
void receiveCallback(const uint8_t *mac, const uint8_t *incomingData, int len)
|
||||||
|
{
|
||||||
if (len != sizeof(ControlPadInput))
|
if (len != sizeof(ControlPadInput))
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
controlPad->insertData(incomingData);
|
controlPad->insertData(incomingData);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendCallback (const uint8_t *mac_addr, esp_now_send_status_t status) {
|
void sendCallback(const uint8_t *mac_addr, esp_now_send_status_t status)
|
||||||
|
{
|
||||||
if (status != ESP_NOW_SEND_SUCCESS)
|
if (status != ESP_NOW_SEND_SUCCESS)
|
||||||
|
{
|
||||||
std::cout << "sendCallback - Delivery Fail" << std::endl;
|
std::cout << "sendCallback - Delivery Fail" << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcdWrapperCallback (const char data[][LcdWrapper::totalRows], uint8_t lines, uint8_t rows) {
|
void lcdWrapperCallback(const char data[][LcdWrapper::totalRows], uint8_t lines, uint8_t rows)
|
||||||
|
{
|
||||||
if (!controlPad->isControlPadConnected())
|
if (!controlPad->isControlPadConnected())
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const esp_err_t result = esp_now_send(network->getBroadcastAddress(), reinterpret_cast<const uint8_t *>(data), lines * rows);
|
||||||
|
|
||||||
esp_err_t result = esp_now_send(network->getBroadcastAddress(), (uint8_t *) data, lines * rows);
|
|
||||||
|
|
||||||
if (result != ESP_OK)
|
if (result != ESP_OK)
|
||||||
|
{
|
||||||
Serial.println("Error sending the data");
|
Serial.println("Error sending the data");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkAdresses setIPs() {
|
NetworkAdresses setIPs()
|
||||||
|
{
|
||||||
NetworkAdresses adresses;
|
NetworkAdresses adresses;
|
||||||
adresses.localIP.fromString(NetworkConfig::ip);
|
adresses.localIP.fromString(static_cast<const char *>(NetworkConfig::ip));
|
||||||
adresses.subnet.fromString(NetworkConfig::subnet);
|
adresses.subnet.fromString(static_cast<const char *>(NetworkConfig::subnet));
|
||||||
adresses.gateway.fromString(NetworkConfig::gateway);
|
adresses.gateway.fromString(static_cast<const char *>(NetworkConfig::gateway));
|
||||||
adresses.dnsServer.fromString(NetworkConfig::dns);
|
adresses.dnsServer.fromString(static_cast<const char *>(NetworkConfig::dns));
|
||||||
if (NetworkConfig::mqtt) {
|
if (NetworkConfig::mqtt)
|
||||||
adresses.mqttServer.fromString(MqttConfig::server);
|
{
|
||||||
|
adresses.mqttServer.fromString(static_cast<const char *>(MqttConfig::server));
|
||||||
adresses.mqttPort = MqttConfig::port;
|
adresses.mqttPort = MqttConfig::port;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+111
-77
@@ -4,41 +4,40 @@
|
|||||||
* @brief Contains an implementation of the class MoveControl
|
* @brief Contains an implementation of the class MoveControl
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @date 2022-02-15
|
* @date 2022-02-15
|
||||||
*
|
*
|
||||||
* @copyright Copyright (c) 2022
|
* @copyright Copyright (c) 2022
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include "moveControl.h"
|
#include "moveControl.h"
|
||||||
|
|
||||||
MoveControl::MoveControl() {
|
MoveControl::MoveControl()
|
||||||
this->loopDelay = 20;
|
: Component(MoveControl::loopDelay),
|
||||||
this->left_motor = new MotorControl();
|
left_motor{new MotorControl()},
|
||||||
this->right_motor = new MotorControl();
|
right_motor{new MotorControl()},
|
||||||
this->left_speedometer = new Speedometer(PinNumbers::LeftMotor::encoder, Settings::wheelDiameter, Settings::encoderSteps);
|
left_speedometer{new Speedometer(PinNumbers::LeftMotor::encoder, Settings::wheelDiameter, Settings::encoderSteps)},
|
||||||
this->right_speedometer = new Speedometer(PinNumbers::RightMotor::encoder, Settings::wheelDiameter, Settings::encoderSteps);
|
right_speedometer{new Speedometer(PinNumbers::RightMotor::encoder, Settings::wheelDiameter, Settings::encoderSteps)},
|
||||||
|
left_pid{new PID(&this->wheelspeed_left,
|
||||||
this->left_pid = new PID( &this->wheelspeed_left,
|
&this->left_pid_out,
|
||||||
&this->left_pid_out,
|
&this->wheelspeed_left_target,
|
||||||
&this->wheelspeed_left_target,
|
Settings::Pid::Left::P,
|
||||||
Settings::Pid::Left::P,
|
Settings::Pid::Left::I,
|
||||||
Settings::Pid::Left::I,
|
Settings::Pid::Left::D,
|
||||||
Settings::Pid::Left::D,
|
DIRECT)},
|
||||||
DIRECT);
|
right_pid{new PID(&this->wheelspeed_right,
|
||||||
this->right_pid = new PID( &this->wheelspeed_right,
|
&this->right_pid_out,
|
||||||
&this->right_pid_out,
|
&this->wheelspeed_right_target,
|
||||||
&this->wheelspeed_right_target,
|
Settings::Pid::Right::P,
|
||||||
Settings::Pid::Right::P,
|
Settings::Pid::Right::I,
|
||||||
Settings::Pid::Right::I,
|
Settings::Pid::Right::D,
|
||||||
Settings::Pid::Right::D,
|
DIRECT)}
|
||||||
DIRECT);
|
{
|
||||||
|
|
||||||
this->left_pid->SetOutputLimits(Settings::Pid::outMin, Settings::Pid::outMax);
|
this->left_pid->SetOutputLimits(Settings::Pid::outMin, Settings::Pid::outMax);
|
||||||
this->left_pid->SetSampleTime(Settings::Pid::sampleTime);
|
this->left_pid->SetSampleTime(Settings::Pid::sampleTime);
|
||||||
this->left_pid->SetMode(AUTOMATIC);
|
this->left_pid->SetMode(AUTOMATIC);
|
||||||
|
|
||||||
this->right_pid->SetOutputLimits(Settings::Pid::outMin, Settings::Pid::outMax);
|
this->right_pid->SetOutputLimits(Settings::Pid::outMin, Settings::Pid::outMax);
|
||||||
this->right_pid->SetSampleTime(Settings::Pid::sampleTime);
|
this->right_pid->SetSampleTime(Settings::Pid::sampleTime);
|
||||||
this->right_pid->SetMode(AUTOMATIC);
|
this->right_pid->SetMode(AUTOMATIC);
|
||||||
|
|
||||||
this->left_motor->init(PinNumbers::LeftMotor::pwm, PinNumbers::LeftMotor::pmwChannel, PinNumbers::LeftMotor::dir1, PinNumbers::LeftMotor::dir2);
|
this->left_motor->init(PinNumbers::LeftMotor::pwm, PinNumbers::LeftMotor::pmwChannel, PinNumbers::LeftMotor::dir1, PinNumbers::LeftMotor::dir2);
|
||||||
this->right_motor->init(PinNumbers::RightMotor::pwm, PinNumbers::RightMotor::pmwChannel, PinNumbers::RightMotor::dir1, PinNumbers::RightMotor::dir2);
|
this->right_motor->init(PinNumbers::RightMotor::pwm, PinNumbers::RightMotor::pmwChannel, PinNumbers::RightMotor::dir1, PinNumbers::RightMotor::dir2);
|
||||||
@@ -46,10 +45,11 @@ MoveControl::MoveControl() {
|
|||||||
this->addChildComponent(this->left_motor);
|
this->addChildComponent(this->left_motor);
|
||||||
this->addChildComponent(this->right_motor);
|
this->addChildComponent(this->right_motor);
|
||||||
this->addChildComponent(this->left_speedometer);
|
this->addChildComponent(this->left_speedometer);
|
||||||
this->addChildComponent(this->right_speedometer);
|
this->addChildComponent(this->right_speedometer);
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveControl::~MoveControl() {
|
MoveControl::~MoveControl()
|
||||||
|
{
|
||||||
this->left_motor->emergencyStop();
|
this->left_motor->emergencyStop();
|
||||||
this->right_motor->emergencyStop();
|
this->right_motor->emergencyStop();
|
||||||
|
|
||||||
@@ -59,10 +59,10 @@ MoveControl::~MoveControl() {
|
|||||||
delete this->right_speedometer;
|
delete this->right_speedometer;
|
||||||
delete this->left_pid;
|
delete this->left_pid;
|
||||||
delete this->right_pid;
|
delete this->right_pid;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::run() {
|
void MoveControl::run()
|
||||||
|
{
|
||||||
this->updateCurrentWheelSpeed();
|
this->updateCurrentWheelSpeed();
|
||||||
this->calcTargetWheelSpeed();
|
this->calcTargetWheelSpeed();
|
||||||
|
|
||||||
@@ -72,7 +72,8 @@ void MoveControl::run() {
|
|||||||
this->regulateMotors();
|
this->regulateMotors();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::setDrivingStatus(Status status) {
|
void MoveControl::setDrivingStatus(Status status)
|
||||||
|
{
|
||||||
this->setSpeed(0);
|
this->setSpeed(0);
|
||||||
this->setRotationSpeed(0);
|
this->setRotationSpeed(0);
|
||||||
this->setRawPowerLeft(0);
|
this->setRawPowerLeft(0);
|
||||||
@@ -97,7 +98,8 @@ void MoveControl::setDrivingStatus(Status status) {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::emergencyStop() {
|
void MoveControl::emergencyStop()
|
||||||
|
{
|
||||||
this->left_motor->emergencyStop();
|
this->left_motor->emergencyStop();
|
||||||
this->right_motor->emergencyStop();
|
this->right_motor->emergencyStop();
|
||||||
this->setSpeed(0);
|
this->setSpeed(0);
|
||||||
@@ -107,8 +109,10 @@ void MoveControl::emergencyStop() {
|
|||||||
this->driving_status = Status::Stop;
|
this->driving_status = Status::Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::setSpeed(double speed) {
|
void MoveControl::setSpeed(double speed)
|
||||||
if (speed < 0.2 && speed > -0.2) {
|
{
|
||||||
|
if (speed < MoveControl::minSpeed && speed > -MoveControl::minSpeed)
|
||||||
|
{
|
||||||
this->drivingSpeeds.x = 0;
|
this->drivingSpeeds.x = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -116,8 +120,10 @@ void MoveControl::setSpeed(double speed) {
|
|||||||
this->drivingSpeeds.x = speed;
|
this->drivingSpeeds.x = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::setRotationSpeed(double speed) {
|
void MoveControl::setRotationSpeed(double speed)
|
||||||
if (speed < 0.1 && speed > -0.1){
|
{
|
||||||
|
if (speed < MoveControl::minSpeed && speed > -MoveControl::minSpeed)
|
||||||
|
{
|
||||||
this->drivingSpeeds.rot = 0;
|
this->drivingSpeeds.rot = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -125,92 +131,120 @@ void MoveControl::setRotationSpeed(double speed) {
|
|||||||
this->drivingSpeeds.rot = speed;
|
this->drivingSpeeds.rot = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::setSpeeds(DrivingSpeeds drivingSpeeds) {
|
void MoveControl::setSpeeds(DrivingSpeeds drivingSpeeds)
|
||||||
|
{
|
||||||
this->setSpeed(drivingSpeeds.x);
|
this->setSpeed(drivingSpeeds.x);
|
||||||
this->setRotationSpeed(drivingSpeeds.rot);
|
this->setRotationSpeed(drivingSpeeds.rot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::setRawPowerLeft(int16_t power) {
|
void MoveControl::setRawPowerLeft(int16_t power)
|
||||||
if (power <= 100 && power >= -100)
|
{
|
||||||
this->rawPowerLeft = power;
|
if (power <= MoveControl::maxPercentage && power >= -MoveControl::maxPercentage)
|
||||||
|
{
|
||||||
|
this->rawPowerLeft = static_cast<int8_t>(power);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::setRawPowerRight(int16_t power) {
|
void MoveControl::setRawPowerRight(int16_t power)
|
||||||
if (power <= 100 && power >= -100)
|
{
|
||||||
this->rawPowerRight = power;
|
if (power <= MoveControl::maxPercentage && power >= -MoveControl::maxPercentage)
|
||||||
|
{
|
||||||
|
this->rawPowerRight = static_cast<int8_t>(power);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::setPidTunings(uint8_t side, double p, double i, double d) {
|
void MoveControl::setPidTunings(uint8_t side, double pPart, double iPart, double dPart)
|
||||||
PID* selectedPID = nullptr;
|
{
|
||||||
|
PID *selectedPID = nullptr;
|
||||||
if (side == 0)
|
if (side == 0)
|
||||||
|
{
|
||||||
selectedPID = this->left_pid;
|
selectedPID = this->left_pid;
|
||||||
|
}
|
||||||
else if (side == 1)
|
else if (side == 1)
|
||||||
|
{
|
||||||
selectedPID = this->right_pid;
|
selectedPID = this->right_pid;
|
||||||
|
}
|
||||||
|
|
||||||
selectedPID->SetTunings(p, i, d);
|
selectedPID->SetTunings(pPart, iPart, dPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
PID* MoveControl::getPID(uint8_t side) const {
|
PID *MoveControl::getPID(uint8_t side) const
|
||||||
|
{
|
||||||
if (side == 0)
|
if (side == 0)
|
||||||
|
{
|
||||||
return this->left_pid;
|
return this->left_pid;
|
||||||
else if (side == 1)
|
}
|
||||||
|
if (side == 1)
|
||||||
|
{
|
||||||
return this->right_pid;
|
return this->right_pid;
|
||||||
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::setSpeedometerDirection(Speedometer *speedometer, double value) {
|
void MoveControl::setSpeedometerDirection(Speedometer *speedometer, double value)
|
||||||
|
{
|
||||||
if (value > 0)
|
if (value > 0)
|
||||||
|
{
|
||||||
speedometer->setDirection(Speedometer::Direction::Forward);
|
speedometer->setDirection(Speedometer::Direction::Forward);
|
||||||
|
}
|
||||||
else if (value < 0)
|
else if (value < 0)
|
||||||
|
{
|
||||||
speedometer->setDirection(Speedometer::Direction::Backward);
|
speedometer->setDirection(Speedometer::Direction::Backward);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
speedometer->setDirection(Speedometer::Direction::None);
|
speedometer->setDirection(Speedometer::Direction::None);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::calcTargetWheelSpeed() {
|
void MoveControl::calcTargetWheelSpeed()
|
||||||
|
{
|
||||||
/* original formula:
|
/* original formula:
|
||||||
(1 / r) / 1 b \ / x \ = / Xl \
|
(1 / r) / 1 b \ / x \ = / Xl \
|
||||||
\ 1 -b / \ T / \ Xr / */
|
\ 1 -b / \ T / \ Xr / */
|
||||||
|
|
||||||
// (1 / r) * 1
|
// (1 / r) * 1
|
||||||
constexpr double A = 1.0 / (Settings::wheelDiameter / 2);
|
constexpr double A1r1 = 1.0 / (Settings::wheelDiameter / 2);
|
||||||
// (1 / r) * b
|
// (1 / r) * b
|
||||||
constexpr double B = (1.0 / (Settings::wheelDiameter / 2)) * (Settings::wheelDistance / 2);
|
constexpr double B1rb = (1.0 / (Settings::wheelDiameter / 2)) * (Settings::wheelDistance / 2);
|
||||||
|
|
||||||
this->wheelspeed_right_target = (A * this->drivingSpeeds.x + B * this->drivingSpeeds.rot);
|
this->wheelspeed_right_target = (A1r1 * this->drivingSpeeds.x + B1rb * this->drivingSpeeds.rot);
|
||||||
this->wheelspeed_left_target = (A * this->drivingSpeeds.x + (-B) * this->drivingSpeeds.rot);
|
this->wheelspeed_left_target = (A1r1 * this->drivingSpeeds.x + (-B1rb) * this->drivingSpeeds.rot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::regulateMotors() {
|
void MoveControl::regulateMotors()
|
||||||
switch (this->driving_status) {
|
{
|
||||||
case Status::Stop :
|
switch (this->driving_status)
|
||||||
this->left_motor->setTargetPower(0);
|
{
|
||||||
this->right_motor->setTargetPower(0);
|
case Status::Stop:
|
||||||
this->setSpeedometerDirection(this->left_speedometer, 0);
|
this->left_motor->setTargetPower(0);
|
||||||
this->setSpeedometerDirection(this->right_speedometer, 0);
|
this->right_motor->setTargetPower(0);
|
||||||
break;
|
this->setSpeedometerDirection(this->left_speedometer, 0);
|
||||||
|
this->setSpeedometerDirection(this->right_speedometer, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
case Status::Drive :
|
case Status::Drive:
|
||||||
this->left_motor->setTargetPower( (int8_t) this->left_pid_out);
|
this->left_motor->setTargetPower(static_cast<int8_t>(this->left_pid_out));
|
||||||
this->right_motor->setTargetPower( (int8_t) this->right_pid_out);
|
this->right_motor->setTargetPower(static_cast<int8_t>(this->right_pid_out));
|
||||||
this->setSpeedometerDirection(this->left_speedometer, this->left_motor->getPower());
|
this->setSpeedometerDirection(this->left_speedometer, this->left_motor->getPower());
|
||||||
this->setSpeedometerDirection(this->right_speedometer, this->right_motor->getPower());
|
this->setSpeedometerDirection(this->right_speedometer, this->right_motor->getPower());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Status::Raw :
|
case Status::Raw:
|
||||||
this->left_motor->setTargetPower(this->rawPowerLeft);
|
this->left_motor->setTargetPower(this->rawPowerLeft);
|
||||||
this->right_motor->setTargetPower(this->rawPowerRight);
|
this->right_motor->setTargetPower(this->rawPowerRight);
|
||||||
this->setSpeedometerDirection(this->left_speedometer, this->rawPowerLeft);
|
this->setSpeedometerDirection(this->left_speedometer, this->rawPowerLeft);
|
||||||
this->setSpeedometerDirection(this->right_speedometer, this->rawPowerRight);
|
this->setSpeedometerDirection(this->right_speedometer, this->rawPowerRight);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Serial.println("Wrong drivingState in MoveControl::regulateMotors");
|
Serial.println("Wrong drivingState in MoveControl::regulateMotors");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MoveControl::updateCurrentWheelSpeed() {
|
void MoveControl::updateCurrentWheelSpeed()
|
||||||
|
{
|
||||||
this->wheelspeed_left = this->left_speedometer->getSpeedRad();
|
this->wheelspeed_left = this->left_speedometer->getSpeedRad();
|
||||||
this->wheelspeed_right = this->right_speedometer->getSpeedRad();
|
this->wheelspeed_right = this->right_speedometer->getSpeedRad();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user