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 spiSck = 5;
|
||||
constexpr uint8_t gnssSpiCs = 17;
|
||||
constexpr uint8_t sda = 21;
|
||||
constexpr uint8_t scl = 19;
|
||||
constexpr uint8_t battery = 35;
|
||||
|
||||
namespace LeftMotor {
|
||||
constexpr uint8_t dir1 = 27;
|
||||
@@ -35,6 +38,9 @@ namespace PinNumbers {
|
||||
}
|
||||
|
||||
namespace Settings {
|
||||
constexpr uint32_t baudRate = 115200;
|
||||
constexpr uint32_t i2cSpeed = 400000;
|
||||
|
||||
constexpr float wheelDiameter = 0.105;
|
||||
constexpr float wheelDistance = 0.255;
|
||||
constexpr uint16_t encoderSteps = 384;
|
||||
|
||||
@@ -123,7 +123,7 @@ class MoveControl : public Component {
|
||||
* @param i
|
||||
* @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.
|
||||
@@ -152,7 +152,7 @@ class MoveControl : public Component {
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
void setSpeedometerDirection(Speedometer *speedometer, double value);
|
||||
static void setSpeedometerDirection(Speedometer *speedometer, double value);
|
||||
void calcTargetWheelSpeed();
|
||||
void regulateMotors();
|
||||
void updateCurrentWheelSpeed();
|
||||
@@ -171,12 +171,17 @@ class MoveControl : public Component {
|
||||
double wheelspeed_right_target = 0;
|
||||
double wheelspeed_left = 0;
|
||||
double wheelspeed_right = 0;
|
||||
double left_pid_out;
|
||||
double right_pid_out;
|
||||
double left_pid_out = 0;
|
||||
double right_pid_out = 0;
|
||||
|
||||
uint8_t overTimeCounter = 0;
|
||||
uint8_t overTimeMax = 100;
|
||||
int8_t rawPowerLeft = 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
|
||||
|
||||
+110
-70
@@ -11,23 +11,25 @@
|
||||
|
||||
#include "battery.h"
|
||||
|
||||
Battery::Battery(uint8_t pin, uint32_t r1, uint32_t r2) {
|
||||
this->pin = pin;
|
||||
this->r1 = r1;
|
||||
this->r2 = r2;
|
||||
this->batteryVoltageFactor = (double) (this->r1 + this->r2) / (double) this->r2;
|
||||
Battery::Battery(uint8_t pin, uint32_t firstResistor, uint32_t secondResistor)
|
||||
: pin{pin}, firstResistor{firstResistor}, secondResistor{secondResistor},
|
||||
batteryVoltageFactor{firstResistor + secondResistor / static_cast<double>(secondResistor)}
|
||||
{
|
||||
this->initBuffer();
|
||||
this->loopDelay = 100;
|
||||
Component::loopDelay = Battery::loopDelay;
|
||||
}
|
||||
|
||||
Battery::Battery(uint8_t pin) {
|
||||
this->pin = pin;
|
||||
Battery::Battery(uint8_t pin)
|
||||
: pin{pin}
|
||||
{
|
||||
this->initBuffer();
|
||||
this->loopDelay = 100;
|
||||
Component::loopDelay = Battery::loopDelay;
|
||||
}
|
||||
|
||||
void Battery::run() {
|
||||
if (this->calibrationState != CalibrationState::None) {
|
||||
void Battery::run()
|
||||
{
|
||||
if (this->calibrationState != CalibrationState::None)
|
||||
{
|
||||
this->runCalibration();
|
||||
return;
|
||||
}
|
||||
@@ -35,23 +37,26 @@ void Battery::run() {
|
||||
this->readAdcToBuf();
|
||||
this->loopCounter++;
|
||||
|
||||
if (this->loopCounter >= this->calulationDelayMultiplier) {
|
||||
if (this->loopCounter >= this->calulationDelayMultiplier)
|
||||
{
|
||||
this->calculateBatteryVoltage();
|
||||
this->calculateBatteryPercent();
|
||||
this->loopCounter = 0;
|
||||
this->calculatetNewValues = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Battery::runCalibration()
|
||||
{
|
||||
if (this->calibrationState != CalibrationState::Reading)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void Battery::runCalibration() {
|
||||
if (this->calibrationState != CalibrationState::Reading)
|
||||
return;
|
||||
|
||||
this->readAdcToBuf();
|
||||
if (this->bufferPos == 0) {
|
||||
uint16_t res = this->getBufAvg();
|
||||
if (this->bufferPos == 0)
|
||||
{
|
||||
const uint16_t res = this->getBufAvg();
|
||||
this->newRawAdcVoltages[this->currentCalibrationVoltage] = res;
|
||||
std::cout << "Index: "
|
||||
<< (int)this->currentCalibrationVoltage
|
||||
@@ -61,138 +66,173 @@ void Battery::runCalibration() {
|
||||
this->currentCalibrationVoltage++;
|
||||
this->calibrationState = CalibrationState::Waiting;
|
||||
|
||||
if (this->currentCalibrationVoltage == 60) {
|
||||
if (this->currentCalibrationVoltage == Battery::rawAdcVoltagesCount)
|
||||
{
|
||||
this->calibrationState = CalibrationState::Finished;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double Battery::getBatteryVoltage() const {
|
||||
double res = this->batteryVoltage;
|
||||
return (int)(res*100+0.5)/100.0;
|
||||
double Battery::getBatteryVoltage() const
|
||||
{
|
||||
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)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Battery::isNewValue() {
|
||||
bool Battery::isNewValue()
|
||||
{
|
||||
if (!this->calculatetNewValues)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this->calculatetNewValues = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Battery::nextVoltageIsReady() {
|
||||
if (this->calibrationState == CalibrationState::Waiting) {
|
||||
void Battery::nextVoltageIsReady()
|
||||
{
|
||||
if (this->calibrationState == CalibrationState::Waiting)
|
||||
{
|
||||
this->calibrationState = CalibrationState::Reading;
|
||||
}
|
||||
}
|
||||
|
||||
void Battery::startCalibration() {
|
||||
void Battery::startCalibration()
|
||||
{
|
||||
this->calibrationState = CalibrationState::Waiting;
|
||||
this->currentCalibrationVoltage = 0;
|
||||
this->bufferPos = 0;
|
||||
this->loopDelay = 50;
|
||||
this->newRawAdcVoltages = new uint16_t[60];
|
||||
Component::loopDelay = Battery::loopDelay / 2;
|
||||
this->newRawAdcVoltages = new uint16_t[Battery::rawAdcVoltagesCount];
|
||||
}
|
||||
|
||||
void Battery::finishCalibration() {
|
||||
void Battery::finishCalibration()
|
||||
{
|
||||
if (this->calibrationState != CalibrationState::None)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
delete[] this->newRawAdcVoltages;
|
||||
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
|
||||
double reading = this->getBufAvg();
|
||||
if(reading < 1 || reading > 4095) return 0;
|
||||
return - 0.000000000000016 * pow(reading,4)
|
||||
+ 0.000000000118171 * pow(reading,3)
|
||||
- 0.000000301211691 * pow(reading,2)
|
||||
+ 0.001109019271794 * reading
|
||||
+ 0.034143524634089;
|
||||
if (reading < 1 || reading > Battery::adcMaxValue)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Battery::calculateBatteryVoltage() {
|
||||
if (this->r1 && this->r2) {
|
||||
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()
|
||||
{
|
||||
if (this->firstResistor && this->secondResistor)
|
||||
{
|
||||
this->batteryVoltage = this->calculateInputVoltage() * this->batteryVoltageFactor;
|
||||
return;
|
||||
}
|
||||
|
||||
uint16_t adcValue = this->getBufAvg();
|
||||
if (adcValue < this->rawAdcVoltages[0]) {
|
||||
const uint16_t adcValue = this->getBufAvg();
|
||||
if (adcValue < this->rawAdcVoltages[0])
|
||||
{
|
||||
this->batteryVoltage = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (adcValue > this->rawAdcVoltages[this->rawAdcVoltagesCount] + 50) {
|
||||
this->batteryVoltage = -2;
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t index;
|
||||
for (index = 1; index < this->rawAdcVoltagesCount; index++) {
|
||||
uint8_t index = 1;
|
||||
for (; index < this->rawAdcVoltagesCount; index++)
|
||||
{
|
||||
if (adcValue < this->rawAdcVoltages[index])
|
||||
{
|
||||
break;
|
||||
}
|
||||
double indexDelta = this->rawAdcVoltages[index] - this->rawAdcVoltages[index - 1];
|
||||
double valueDelta = this->rawAdcVoltages[index] - adcValue;
|
||||
}
|
||||
const double indexDelta = this->rawAdcVoltages[index] - this->rawAdcVoltages[index - 1];
|
||||
const double valueDelta = this->rawAdcVoltages[index] - adcValue;
|
||||
double voltage = this->startVoltage + (index - 1) * this->stepVoltage;
|
||||
voltage += valueDelta / indexDelta * this->stepVoltage;
|
||||
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);
|
||||
uint8_t i;
|
||||
for (i = 0; i < size; i++) {
|
||||
if (this->batteryVoltage <= this->capacityVoltages[i])
|
||||
uint8_t index = 0;
|
||||
for (; index < size; index++)
|
||||
{
|
||||
if (this->batteryVoltage <= this->capacityVoltages[index])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 0) {
|
||||
if (this->batteryVoltage > 6)
|
||||
if (index == 0)
|
||||
{
|
||||
if (this->batteryVoltage > this->absurdLowVoltage)
|
||||
{
|
||||
std::cout << "Critical low battery!" << std::endl;
|
||||
} else if (i == size - 1) {
|
||||
|
||||
} else {
|
||||
double diffToLowerVal = this->batteryVoltage - this->capacityVoltages[i - 1];
|
||||
double diffToHigherVal = this->capacityVoltages[i] - this->batteryVoltage;
|
||||
}
|
||||
}
|
||||
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)
|
||||
i--;
|
||||
{
|
||||
index--;
|
||||
}
|
||||
this->batteryPercent = i * (100 / (size - 1));
|
||||
}
|
||||
this->batteryPercent = index * (100 / (size - 1));
|
||||
}
|
||||
|
||||
void Battery::readAdcToBuf() {
|
||||
void Battery::readAdcToBuf()
|
||||
{
|
||||
this->adcBuffer[this->bufferPos] = analogRead(this->pin);
|
||||
this->bufferPos++;
|
||||
if (this->bufferPos == Battery::bufferSize)
|
||||
{
|
||||
this->bufferPos = 0;
|
||||
}
|
||||
|
||||
// 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++)
|
||||
{
|
||||
this->adcBuffer[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t Battery::getBufAvg() const {
|
||||
uint16_t Battery::getBufAvg() const
|
||||
{
|
||||
uint32_t res = 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)
|
||||
{
|
||||
emptyPos++;
|
||||
}
|
||||
res += this->adcBuffer[i];
|
||||
}
|
||||
return res / (Battery::bufferSize - emptyPos);
|
||||
|
||||
+20
-11
@@ -27,9 +27,11 @@
|
||||
* to be after a voltage diveder, so that maximum voltage for the
|
||||
* microcontroller is 3.3 Volt.
|
||||
*/
|
||||
class Battery : public Component {
|
||||
class Battery : public Component
|
||||
{
|
||||
public:
|
||||
enum CalibrationState {
|
||||
enum CalibrationState
|
||||
{
|
||||
None,
|
||||
Reading,
|
||||
Waiting,
|
||||
@@ -44,10 +46,10 @@ class Battery : public Component {
|
||||
* the microcontroller is connected to the second resistor.
|
||||
*
|
||||
* @param pin The analog to read from.
|
||||
* @param r1 First resistor of the voltage devider.
|
||||
* @param r2 Second resistor of the voltage devider.
|
||||
* @param firstResistor First 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);
|
||||
|
||||
/**
|
||||
@@ -96,7 +98,9 @@ class Battery : public Component {
|
||||
void initBuffer();
|
||||
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;
|
||||
|
||||
@@ -109,9 +113,9 @@ class Battery : public Component {
|
||||
uint8_t loopCounter = 0;
|
||||
uint8_t currentCalibrationVoltage = 0; // *0.1 + 7
|
||||
uint16_t adcBuffer[bufferSize];
|
||||
uint16_t* newRawAdcVoltages;
|
||||
uint32_t r1 = 0;
|
||||
uint32_t r2 = 0;
|
||||
uint16_t *newRawAdcVoltages = nullptr;
|
||||
uint32_t firstResistor = 0;
|
||||
uint32_t secondResistor = 0;
|
||||
bool calculatetNewValues = false;
|
||||
double batteryVoltage = 0;
|
||||
double batteryVoltageFactor;
|
||||
@@ -123,16 +127,21 @@ class Battery : public Component {
|
||||
12.07, 12.25, 12.33, 12.45, // 80 85 90 95
|
||||
12.6};
|
||||
|
||||
const uint8_t rawAdcVoltagesCount = 60;
|
||||
static constexpr uint8_t rawAdcVoltagesCount = 60;
|
||||
const double startVoltage = 7;
|
||||
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,
|
||||
2298, 2331, 2362, 2387, 2420, 2453, 2482, 2514, 2543, 2577,
|
||||
2607, 2640, 2670, 2703, 2736, 2763, 2794, 2826, 2858, 2890,
|
||||
2920, 2956, 2983, 3019, 3054, 3088, 3121, 3158, 3189, 3226,
|
||||
3264, 3300, 3339, 3379, 3414, 3453, 3500, 3544, 3598, 3636,
|
||||
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
|
||||
|
||||
@@ -11,27 +11,32 @@
|
||||
|
||||
#include "calcAzimuth.h"
|
||||
|
||||
CalcAzimuth::CalcAzimuth(Point point) {
|
||||
this->lastChangePoint = point;
|
||||
this->currentPosition = point;
|
||||
this->loopDelay = 50;
|
||||
CalcAzimuth::CalcAzimuth(Point point)
|
||||
: lastChangePoint{point}, currentPosition{point}
|
||||
{
|
||||
Component::loopDelay = CalcAzimuth::loopDelay;
|
||||
}
|
||||
|
||||
void CalcAzimuth::drivingDirectionChange(Point point) {
|
||||
if (point.isInit() && point.isValid()) {
|
||||
void CalcAzimuth::drivingDirectionChange(Point point)
|
||||
{
|
||||
if (point.isInit() && point.isValid())
|
||||
{
|
||||
this->directionChangeMode = true;
|
||||
this->lastChangePoint = point;
|
||||
this->state = State::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
void CalcAzimuth::updateCurrentPosition(Point point) {
|
||||
void CalcAzimuth::updateCurrentPosition(Point point)
|
||||
{
|
||||
this->currentPosition = point;
|
||||
this->positionChanged = true;
|
||||
}
|
||||
|
||||
String CalcAzimuth::stateToString(State state) {
|
||||
switch (state) {
|
||||
String CalcAzimuth::stateToString(State state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case State::Invalid:
|
||||
return "Invalid";
|
||||
|
||||
@@ -52,38 +57,38 @@ String CalcAzimuth::stateToString(State state) {
|
||||
}
|
||||
}
|
||||
|
||||
void CalcAzimuth::run() {
|
||||
void CalcAzimuth::run()
|
||||
{
|
||||
if (!this->positionChanged)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->positionChanged = false;
|
||||
this->updateAzimuth();
|
||||
}
|
||||
|
||||
void CalcAzimuth::updateAzimuth() {
|
||||
if (!this->directionChangeMode
|
||||
|| this->lastChangePoint.distanceTo(this->currentPosition) < 1.0)
|
||||
void CalcAzimuth::updateAzimuth()
|
||||
{
|
||||
if (!this->directionChangeMode || this->lastChangePoint.distanceTo(this->currentPosition) < 1.0)
|
||||
{
|
||||
this->state = State::Invalid;
|
||||
this->calcAzimuth = 999;
|
||||
this->calcAzimuth = INT16_MIN;
|
||||
return;
|
||||
}
|
||||
|
||||
this->calcAzimuth = this->lastChangePoint.courseTo(this->currentPosition);
|
||||
|
||||
// Map point accuracy to State
|
||||
if (this->lastChangePoint.getAccuracy() == Point::Accuracy::oneDigOfCM
|
||||
|| this->currentPosition.getAccuracy() == Point::Accuracy::oneDigOfCM)
|
||||
if (this->lastChangePoint.getAccuracy() == Point::Accuracy::oneDigOfCM || this->currentPosition.getAccuracy() == Point::Accuracy::oneDigOfCM)
|
||||
{
|
||||
this->state = State::Good;
|
||||
}
|
||||
else if (this->lastChangePoint.getAccuracy() == Point::Accuracy::twoDigOfCM
|
||||
|| this->currentPosition.getAccuracy() == Point::Accuracy::twoDigOfCM)
|
||||
else if (this->lastChangePoint.getAccuracy() == Point::Accuracy::twoDigOfCM || this->currentPosition.getAccuracy() == Point::Accuracy::twoDigOfCM)
|
||||
{
|
||||
this->state = State::Ok;
|
||||
}
|
||||
else if (this->lastChangePoint.getAccuracy() == Point::Accuracy::threeDigOfCM
|
||||
|| this->currentPosition.getAccuracy() == Point::Accuracy::threeDigOfCM)
|
||||
else if (this->lastChangePoint.getAccuracy() == Point::Accuracy::threeDigOfCM || this->currentPosition.getAccuracy() == Point::Accuracy::threeDigOfCM)
|
||||
{
|
||||
this->state = State::Bad;
|
||||
}
|
||||
@@ -93,8 +98,10 @@ void CalcAzimuth::updateAzimuth() {
|
||||
}
|
||||
|
||||
// Upgrade quality if the range grows up
|
||||
if (this->lastChangePoint.distanceTo(this->currentPosition) > 2.0) {
|
||||
switch (this->state) {
|
||||
if (this->lastChangePoint.distanceTo(this->currentPosition) > this->minDistanceForBetterQuality)
|
||||
{
|
||||
switch (this->state)
|
||||
{
|
||||
case State::Bad:
|
||||
this->state = State::Ok;
|
||||
break;
|
||||
|
||||
@@ -15,9 +15,11 @@
|
||||
#include "component.h"
|
||||
#include "point.h"
|
||||
|
||||
class CalcAzimuth : public Component {
|
||||
class CalcAzimuth : public Component
|
||||
{
|
||||
public:
|
||||
enum State {
|
||||
enum State
|
||||
{
|
||||
Invalid,
|
||||
Bad,
|
||||
Ok,
|
||||
@@ -47,6 +49,9 @@ class CalcAzimuth : public Component {
|
||||
bool positionChanged = false;
|
||||
bool directionChangeMode = false;
|
||||
int16_t calcAzimuth = INT16_MAX;
|
||||
double minDistanceForBetterQuality = 2;
|
||||
|
||||
static constexpr uint8_t loopDelay = 50;
|
||||
};
|
||||
|
||||
#endif // CALC_AZIMUTH_H
|
||||
|
||||
@@ -1,25 +1,35 @@
|
||||
#include "component.h"
|
||||
|
||||
Component::Component(uint16_t loopDelay) {
|
||||
this->loopDelay = loopDelay;
|
||||
Component::Component(uint16_t loopDelay) : loopDelay{loopDelay}
|
||||
{
|
||||
}
|
||||
|
||||
void Component::loop() {
|
||||
void Component::loop()
|
||||
{
|
||||
if (!this->active)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->childComponents.size()){
|
||||
if (this->childComponents.size())
|
||||
{
|
||||
std::list<Component *>::iterator it;
|
||||
for (it = this->childComponents.begin(); it != this->childComponents.end(); it++)
|
||||
{
|
||||
(*it)->loop();
|
||||
}
|
||||
}
|
||||
this->runAsChild();
|
||||
|
||||
if (this->onlyChilds)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->loopDelay && millis() - this->lastMillis < this->loopDelay)
|
||||
if (static_cast<bool>(this->loopDelay) && millis() - this->lastMillis < this->loopDelay)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->lastMillis = millis();
|
||||
|
||||
@@ -28,13 +38,17 @@ void Component::loop() {
|
||||
this->afterRun();
|
||||
|
||||
if (this->timeUpdateAfter)
|
||||
{
|
||||
this->lastMillis = millis();
|
||||
}
|
||||
}
|
||||
|
||||
void Component::addChildComponent(Component* child) {
|
||||
void Component::addChildComponent(Component *child)
|
||||
{
|
||||
this->childComponents.push_back(child);
|
||||
}
|
||||
|
||||
void Component::removeChildComponent(Component* child) {
|
||||
void Component::removeChildComponent(Component *child)
|
||||
{
|
||||
this->childComponents.remove(child);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
|
||||
#include <list>
|
||||
|
||||
class Component {
|
||||
class Component
|
||||
{
|
||||
public:
|
||||
Component() {}
|
||||
Component(uint16_t loopDelay);
|
||||
|
||||
@@ -11,27 +11,33 @@
|
||||
|
||||
#include "controlPad.h"
|
||||
|
||||
ControlPad::ControlPad() {
|
||||
this->loopDelay = 5;
|
||||
ControlPad::ControlPad() : Component(5), controlInput{0, 0, 0, 0} {}
|
||||
|
||||
void ControlPad::run()
|
||||
{
|
||||
if (!this->connected)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void ControlPad::run() {
|
||||
if(!this->connected)
|
||||
return;
|
||||
|
||||
if (millis() - this->lastMessageReceive > this->disconnectTime) {
|
||||
if (millis() - this->lastMessageReceive > this->disconnectTime)
|
||||
{
|
||||
this->connected = false;
|
||||
this->controlInput.buttons = 0;
|
||||
this->controlInput.x = 127;
|
||||
this->controlInput.y = 127;
|
||||
this->controlInput.x = UINT8_MAX / 2;
|
||||
this->controlInput.y = UINT8_MAX / 2;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->lastButtons != controlInput.buttons)
|
||||
{
|
||||
this->updated = true;
|
||||
}
|
||||
|
||||
if (this->menuControl && this->controlInput.buttons > 0 && this->updated) {
|
||||
if (this->firstButtonPress) {
|
||||
if (static_cast<bool>(this->menuControl) && this->controlInput.buttons > 0 && this->updated)
|
||||
{
|
||||
if (this->firstButtonPress)
|
||||
{
|
||||
this->menuControl->printMenu();
|
||||
this->firstButtonPress = false;
|
||||
std::cout << "ControlPad::loop - First menu print" << std::endl;
|
||||
@@ -39,38 +45,48 @@ void ControlPad::run() {
|
||||
}
|
||||
|
||||
if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Left))
|
||||
{
|
||||
this->menuControl->left();
|
||||
}
|
||||
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Right))
|
||||
{
|
||||
this->menuControl->right();
|
||||
}
|
||||
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Up))
|
||||
{
|
||||
this->menuControl->up();
|
||||
}
|
||||
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Down))
|
||||
{
|
||||
this->menuControl->down();
|
||||
}
|
||||
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::Yes))
|
||||
{
|
||||
this->menuControl->yes();
|
||||
}
|
||||
else if (ControlPadButton::isControlPadButtonPressed(&this->controlInput, ControlPadButton::PadButton::No))
|
||||
{
|
||||
this->menuControl->no();
|
||||
}
|
||||
|
||||
this->updated = false;
|
||||
this->lastButtons = controlInput.buttons;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void ControlPad::insertData(const uint8_t *data) {
|
||||
void ControlPad::insertData(const uint8_t *data)
|
||||
{
|
||||
this->connected = true;
|
||||
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));
|
||||
if (lastCount != this->controlInput.counter)
|
||||
std::cout << "ControlPad::insertData counter wrong value" << std::endl;
|
||||
|
||||
if (this->controlInput.x > 127 - this->deadZoneX
|
||||
&& this->controlInput.x < 127 + this->deadZoneX)
|
||||
this->controlInput.x = 127;
|
||||
if (this->controlInput.x > UINT8_MAX / 2 - this->deadZoneX && this->controlInput.x < UINT8_MAX / 2 + this->deadZoneX)
|
||||
this->controlInput.x = UINT8_MAX / 2;
|
||||
|
||||
if (this->controlInput.y > 127 - this->deadZoneY
|
||||
&& this->controlInput.y < 127 + this->deadZoneY)
|
||||
this->controlInput.y = 127;
|
||||
if (this->controlInput.y > UINT8_MAX / 2 - this->deadZoneY && this->controlInput.y < UINT8_MAX / 2 + this->deadZoneY)
|
||||
this->controlInput.y = UINT8_MAX / 2;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
#include <controlPadInput.h>
|
||||
#include <component.h>
|
||||
|
||||
class ControlPad : public Component {
|
||||
class ControlPad : public Component
|
||||
{
|
||||
public:
|
||||
ControlPad();
|
||||
|
||||
|
||||
@@ -14,17 +14,19 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct ControlPadInput {
|
||||
struct ControlPadInput
|
||||
{
|
||||
uint8_t buttons;
|
||||
uint8_t x;
|
||||
uint8_t y;
|
||||
uint8_t counter;
|
||||
};
|
||||
|
||||
|
||||
class ControlPadButton {
|
||||
class ControlPadButton
|
||||
{
|
||||
public:
|
||||
enum PadButton {
|
||||
enum PadButton
|
||||
{
|
||||
Left = 4,
|
||||
Right = 8,
|
||||
Up = 2,
|
||||
@@ -34,9 +36,11 @@ class ControlPadButton {
|
||||
Action = 64
|
||||
};
|
||||
|
||||
static bool isControlPadButtonPressed(const ControlPadInput *input, PadButton button) {
|
||||
static bool isControlPadButtonPressed(const ControlPadInput *input, PadButton button)
|
||||
{
|
||||
uint8_t buttonNum = input->buttons;
|
||||
switch (button) {
|
||||
switch (button)
|
||||
{
|
||||
case PadButton::Left:
|
||||
return buttonNum & (uint8_t)PadButton::Left;
|
||||
break;
|
||||
@@ -66,7 +70,8 @@ class ControlPadButton {
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;;
|
||||
return false;
|
||||
;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+21
-14
@@ -1,14 +1,14 @@
|
||||
#include "counter.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
uint8_t Counter::amountOfCounter = 0;
|
||||
|
||||
Counter::Counter(uint8_t pin) {
|
||||
this->pulsePin = pin;
|
||||
|
||||
this->unit = static_cast<pcnt_unit_t>(Counter::amountOfCounter);
|
||||
if (Counter::amountOfCounter < 7)
|
||||
Counter::Counter(uint8_t pin)
|
||||
: pulsePin{pin}, unit{static_cast<pcnt_unit_t>(Counter::amountOfCounter)}
|
||||
{
|
||||
if (Counter::amountOfCounter <= Counter::maxCounter)
|
||||
{
|
||||
Counter::amountOfCounter++;
|
||||
}
|
||||
|
||||
pcnt_config_t config;
|
||||
config.unit = this->unit;
|
||||
@@ -24,33 +24,40 @@ Counter::Counter(uint8_t pin) {
|
||||
pcnt_unit_config(&config);
|
||||
}
|
||||
|
||||
void Counter::pause() {
|
||||
void Counter::pause()
|
||||
{
|
||||
pcnt_counter_pause(this->unit);
|
||||
}
|
||||
|
||||
void Counter::resume() {
|
||||
void Counter::resume()
|
||||
{
|
||||
pcnt_counter_resume(this->unit);
|
||||
}
|
||||
|
||||
void Counter::clear() {
|
||||
void Counter::clear()
|
||||
{
|
||||
pcnt_counter_clear(this->unit);
|
||||
}
|
||||
|
||||
int16_t Counter::getValue() const {
|
||||
int16_t res;
|
||||
int16_t Counter::getValue() const
|
||||
{
|
||||
int16_t res = 0;
|
||||
pcnt_get_counter_value(this->unit, &res);
|
||||
return res;
|
||||
}
|
||||
|
||||
void Counter::setFilterValue(uint16_t value) {
|
||||
void Counter::setFilterValue(uint16_t value)
|
||||
{
|
||||
pcnt_set_filter_value(this->unit, value);
|
||||
this->filterEnable();
|
||||
}
|
||||
|
||||
void Counter::filterEnable() {
|
||||
void Counter::filterEnable()
|
||||
{
|
||||
pcnt_filter_enable(this->unit);
|
||||
}
|
||||
|
||||
void Counter::filterDisable() {
|
||||
void Counter::filterDisable()
|
||||
{
|
||||
pcnt_filter_disable(this->unit);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <driver/pcnt.h>
|
||||
#include <cinttypes>
|
||||
|
||||
class Counter {
|
||||
class Counter
|
||||
{
|
||||
public:
|
||||
Counter(uint8_t pin);
|
||||
|
||||
@@ -20,6 +22,7 @@ class Counter {
|
||||
private:
|
||||
static constexpr int16_t highLimit = INT16_MAX;
|
||||
static constexpr uint8_t lowLimit = 0;
|
||||
static constexpr uint8_t maxCounter = 6;
|
||||
|
||||
static uint8_t amountOfCounter;
|
||||
|
||||
|
||||
@@ -11,55 +11,73 @@
|
||||
|
||||
#include "LcdWrapper.h"
|
||||
|
||||
LcdWrapper::LcdWrapper(LiquidCrystal_I2C* lcd) {
|
||||
this->lcd = lcd;
|
||||
LcdWrapper::LcdWrapper(LiquidCrystal_I2C *lcd)
|
||||
: lcd{lcd}, changed{false}
|
||||
{
|
||||
this->clear();
|
||||
this->changed = false;
|
||||
}
|
||||
|
||||
void LcdWrapper::run() {
|
||||
void LcdWrapper::run()
|
||||
{
|
||||
if (!this->changed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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->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->changed = false;
|
||||
}
|
||||
|
||||
void LcdWrapper::clear() {
|
||||
for (uint8_t i = 0; i < LcdWrapper::totalLines; i++) {
|
||||
for (uint8_t j = 0; j < LcdWrapper::totalRows; j++) {
|
||||
void LcdWrapper::clear()
|
||||
{
|
||||
for (uint8_t i = 0; i < LcdWrapper::totalLines; i++)
|
||||
{
|
||||
for (uint8_t j = 0; j < LcdWrapper::totalRows; j++)
|
||||
{
|
||||
data[i][j] = ' ';
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
row = LcdWrapper::totalRows - 1;
|
||||
}
|
||||
|
||||
if (line > LcdWrapper::totalLines - 1)
|
||||
{
|
||||
line = LcdWrapper::totalLines - 1;
|
||||
}
|
||||
|
||||
this->cursorRow = row;
|
||||
this->cursorLine = line;
|
||||
}
|
||||
|
||||
void LcdWrapper::print(const char *str) {
|
||||
void LcdWrapper::print(const char *str)
|
||||
{
|
||||
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')
|
||||
{
|
||||
break;
|
||||
else
|
||||
}
|
||||
this->data[this->cursorLine][i] = str[inputStringPosition];
|
||||
|
||||
inputStringPosition++;
|
||||
}
|
||||
this->changed = true;
|
||||
|
||||
@@ -25,7 +25,8 @@ typedef void (*LcdWrapperCallback) (const char data[][16], uint8_t lines, uint8_
|
||||
* The class takes the information to print from any thread. The
|
||||
* loop function has to be called to print the data.
|
||||
*/
|
||||
class LcdWrapper : public DisplayWrapper, public Component {
|
||||
class LcdWrapper : public DisplayWrapper, public Component
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Construct a new Lcd Wrapper object
|
||||
@@ -58,10 +59,10 @@ class LcdWrapper : public DisplayWrapper, public Component {
|
||||
|
||||
static constexpr uint8_t totalRows = 16;
|
||||
static constexpr uint8_t totalLines = 2;
|
||||
|
||||
private:
|
||||
void run() override;
|
||||
|
||||
|
||||
LiquidCrystal_I2C *lcd;
|
||||
LcdWrapperCallback callback = nullptr;
|
||||
char data[LcdWrapper::totalLines][LcdWrapper::totalRows];
|
||||
|
||||
@@ -11,58 +11,69 @@
|
||||
|
||||
#include "calibrateCompass.h"
|
||||
|
||||
CalibrateCompass::CalibrateCompass(QMC5883LCompass* compass) {
|
||||
CalibrateCompass::CalibrateCompass(QMC5883LCompass *compass)
|
||||
{
|
||||
this->compass = compass;
|
||||
this->state = State::Ready;
|
||||
this->clearData();
|
||||
this->activateOnlyChilds();
|
||||
}
|
||||
|
||||
void CalibrateCompass::runAsChild() {
|
||||
void CalibrateCompass::runAsChild()
|
||||
{
|
||||
if (this->state != State::Calibrating)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool changed = false;
|
||||
|
||||
this->compass->read();
|
||||
int x = this->compass->getX();
|
||||
int y = this->compass->getY();
|
||||
int z = this->compass->getZ();
|
||||
int xAxis = this->compass->getX();
|
||||
int yAxis = this->compass->getY();
|
||||
int zAxis = this->compass->getZ();
|
||||
|
||||
if(x < this->data.data[0][0]) {
|
||||
this->data.data[0][0] = x;
|
||||
if (xAxis < this->data.data[0][0])
|
||||
{
|
||||
this->data.data[0][0] = xAxis;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if(x > this->data.data[0][1]) {
|
||||
this->data.data[0][1] = x;
|
||||
if (xAxis > this->data.data[0][1])
|
||||
{
|
||||
this->data.data[0][1] = xAxis;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if(y < this->data.data[1][0]) {
|
||||
this->data.data[1][0] = y;
|
||||
if (yAxis < this->data.data[1][0])
|
||||
{
|
||||
this->data.data[1][0] = yAxis;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if(y > this->data.data[1][1]) {
|
||||
this->data.data[1][1] = y;
|
||||
if (yAxis > this->data.data[1][1])
|
||||
{
|
||||
this->data.data[1][1] = yAxis;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if(z < this->data.data[2][0]) {
|
||||
this->data.data[2][0] = z;
|
||||
if (zAxis < this->data.data[2][0])
|
||||
{
|
||||
this->data.data[2][0] = zAxis;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if(z > this->data.data[2][1]) {
|
||||
this->data.data[2][1] = z;
|
||||
if (zAxis > this->data.data[2][1])
|
||||
{
|
||||
this->data.data[2][1] = zAxis;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
this->lastChange = millis();
|
||||
|
||||
if (millis() - this->lastChange > this->maxTimeWithoutChange) {
|
||||
if (millis() - this->lastChange > this->maxTimeWithoutChange)
|
||||
{
|
||||
this->state = State::Finished;
|
||||
this->checkDataValidity();
|
||||
}
|
||||
@@ -70,9 +81,12 @@ void CalibrateCompass::runAsChild() {
|
||||
|
||||
void CalibrateCompass::run() {}
|
||||
|
||||
void CalibrateCompass::start() {
|
||||
void CalibrateCompass::start()
|
||||
{
|
||||
if (this->state != State::Ready)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->clearData();
|
||||
this->state = State::Calibrating;
|
||||
@@ -80,8 +94,10 @@ void CalibrateCompass::start() {
|
||||
this->lastChange = millis();
|
||||
}
|
||||
|
||||
void CalibrateCompass::useData() {
|
||||
if (!this->dataValid) {
|
||||
void CalibrateCompass::useData()
|
||||
{
|
||||
if (!this->dataValid)
|
||||
{
|
||||
std::cout << "CalibrateCompass::useData - Data not valid" << std::endl;
|
||||
return;
|
||||
}
|
||||
@@ -91,24 +107,28 @@ void CalibrateCompass::useData() {
|
||||
this->data.data[1][0],
|
||||
this->data.data[1][1],
|
||||
this->data.data[2][0],
|
||||
this->data.data[2][1]
|
||||
);
|
||||
this->data.data[2][1]);
|
||||
|
||||
std::cout << "CalibrateCompass::useData " << *this << std::endl;
|
||||
}
|
||||
|
||||
void CalibrateCompass::removeCalibration() {
|
||||
void CalibrateCompass::removeCalibration()
|
||||
{
|
||||
this->compass->clearCalibration();
|
||||
}
|
||||
|
||||
void CalibrateCompass::reset() {
|
||||
void CalibrateCompass::reset()
|
||||
{
|
||||
this->clearData();
|
||||
this->state = State::Ready;
|
||||
}
|
||||
|
||||
void CalibrateCompass::saveData() {
|
||||
void CalibrateCompass::saveData()
|
||||
{
|
||||
if (!this->dataValid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Preferences preferences;
|
||||
preferences.begin("compass", false);
|
||||
@@ -123,7 +143,8 @@ void CalibrateCompass::saveData() {
|
||||
preferences.end();
|
||||
}
|
||||
|
||||
void CalibrateCompass::loadData() {
|
||||
void CalibrateCompass::loadData()
|
||||
{
|
||||
Preferences preferences;
|
||||
preferences.begin("compass", true);
|
||||
|
||||
@@ -138,19 +159,22 @@ void CalibrateCompass::loadData() {
|
||||
this->checkDataValidity();
|
||||
}
|
||||
|
||||
void CalibrateCompass::clearData() {
|
||||
for (uint8_t i = 0; i < 3; i++) {
|
||||
void CalibrateCompass::clearData()
|
||||
{
|
||||
for (uint8_t i = 0; i < 3; i++)
|
||||
{
|
||||
this->data.data[i][0] = 0;
|
||||
this->data.data[i][1] = 0;
|
||||
}
|
||||
this->dataValid = false;
|
||||
}
|
||||
|
||||
void CalibrateCompass::checkDataValidity() {
|
||||
void CalibrateCompass::checkDataValidity()
|
||||
{
|
||||
int sum = 0;
|
||||
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)
|
||||
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)
|
||||
{
|
||||
this->dataValid = false;
|
||||
return;
|
||||
@@ -161,7 +185,8 @@ void CalibrateCompass::checkDataValidity() {
|
||||
this->dataValid = sum;
|
||||
}
|
||||
|
||||
std::ostream& operator<<(std::ostream& os, const CalibrateCompass& caliComp) {
|
||||
std::ostream &operator<<(std::ostream &os, const CalibrateCompass &caliComp)
|
||||
{
|
||||
os << "(";
|
||||
os << caliComp.data.data[0][0];
|
||||
os << ", ";
|
||||
|
||||
+23
-1
@@ -30,7 +30,11 @@ build_type = debug
|
||||
monitor_filters = esp32_exception_decoder
|
||||
check_tool = clangtidy
|
||||
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]
|
||||
platform = native
|
||||
@@ -38,3 +42,21 @@ test_ignore = test_embedded
|
||||
|
||||
[platformio]
|
||||
description = A Rover who should be drive a route by gps.
|
||||
|
||||
|
||||
; Bei Möglichkeit folgendes aus clang tidy entfernen
|
||||
; cppcoreguidelines-owning-memory
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
;
|
||||
#
|
||||
|
||||
@@ -11,26 +11,34 @@
|
||||
|
||||
#include "menuRoute.h"
|
||||
|
||||
MenuActionRoute::MenuActionRoute(MenuRoute* menuRoute, DataFunction dataFunction) {
|
||||
MenuActionRoute::MenuActionRoute(MenuRoute *menuRoute, DataFunction dataFunction)
|
||||
{
|
||||
this->menuRoute = menuRoute;
|
||||
this->dataFunction = dataFunction;
|
||||
}
|
||||
|
||||
void MenuActionRoute::action() {
|
||||
void MenuActionRoute::action()
|
||||
{
|
||||
(this->menuRoute->*this->dataFunction)(0);
|
||||
}
|
||||
|
||||
MenuRoute::MenuRoute(Route* route) {
|
||||
MenuRoute::MenuRoute(Route *route)
|
||||
{
|
||||
this->route = route;
|
||||
}
|
||||
|
||||
MenuRoute::~MenuRoute() {
|
||||
MenuRoute::~MenuRoute()
|
||||
{
|
||||
if (isInit)
|
||||
{
|
||||
delete this->mainMenu;
|
||||
}
|
||||
}
|
||||
|
||||
void MenuRoute::printMenu() {
|
||||
if (!this->isInit) {
|
||||
void MenuRoute::printMenu()
|
||||
{
|
||||
if (!this->isInit)
|
||||
{
|
||||
this->isInit = true;
|
||||
this->init();
|
||||
}
|
||||
@@ -38,72 +46,103 @@ void MenuRoute::printMenu() {
|
||||
this->mainMenu->printMenu();
|
||||
}
|
||||
|
||||
|
||||
void MenuRoute::down() {
|
||||
if (blockInput) return;
|
||||
void MenuRoute::down()
|
||||
{
|
||||
if (blockInput)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this->mainMenu->down();
|
||||
}
|
||||
|
||||
void MenuRoute::up() {
|
||||
if (blockInput) return;
|
||||
void MenuRoute::up()
|
||||
{
|
||||
if (blockInput)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this->mainMenu->up();
|
||||
}
|
||||
|
||||
void MenuRoute::right() {
|
||||
if (blockInput) return;
|
||||
void MenuRoute::right()
|
||||
{
|
||||
if (blockInput)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this->mainMenu->right();
|
||||
}
|
||||
|
||||
void MenuRoute::left() {
|
||||
if (blockInput) return;
|
||||
void MenuRoute::left()
|
||||
{
|
||||
if (blockInput)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this->mainMenu->isInSubmenu())
|
||||
{
|
||||
this->mainMenu->left();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->parentMenu->printMenu();
|
||||
}
|
||||
}
|
||||
|
||||
void MenuRoute::yes() {
|
||||
if (blockInput) return;
|
||||
void MenuRoute::yes()
|
||||
{
|
||||
if (blockInput)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this->mainMenu->yes();
|
||||
}
|
||||
|
||||
void MenuRoute::no() {
|
||||
if (blockInput) return;
|
||||
void MenuRoute::no()
|
||||
{
|
||||
if (blockInput)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this->mainMenu->isInSubmenu())
|
||||
{
|
||||
this->mainMenu->no();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->left();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MenuRoute::init() {
|
||||
void MenuRoute::init()
|
||||
{
|
||||
// auto dummy = []() {
|
||||
// std::cout << "Dummy in Action" <<std::endl;
|
||||
// };
|
||||
|
||||
this->mainMenu = new Menu;
|
||||
MenuRoutePoints* pointsMenu = new MenuRoutePoints(this->route);
|
||||
auto *pointsMenu = new MenuRoutePoints(this->route);
|
||||
|
||||
this->mainMenu->setLcd(this->lcd);
|
||||
pointsMenu->setLcd(this->lcd);
|
||||
|
||||
auto importWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::importRoute));
|
||||
auto exportWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::exportRoute));
|
||||
auto deleteWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::deleteRoute));
|
||||
auto clearWrapper = new MenuActionRoute(this, &MenuRoute::clearRoute);
|
||||
auto *importWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::importRoute));
|
||||
auto *exportWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::exportRoute));
|
||||
auto *deleteWrapper = new MenuIntInput(1, new MenuRouteWrapper(this, &MenuRoute::deleteRoute));
|
||||
auto *clearWrapper = new MenuActionRoute(this, &MenuRoute::clearRoute);
|
||||
|
||||
importWrapper->setLcd(this->lcd);
|
||||
importWrapper->setMinMax(0, 100);
|
||||
importWrapper->setMinMax(0, MenuRoute::maxRouteNumber);
|
||||
importWrapper->setPrintParentMenu(false);
|
||||
importWrapper->setEntry(0, "Import Route");
|
||||
|
||||
exportWrapper->setLcd(this->lcd);
|
||||
exportWrapper->setMinMax(0, 100);
|
||||
exportWrapper->setMinMax(0, MenuRoute::maxRouteNumber);
|
||||
exportWrapper->setPrintParentMenu(false);
|
||||
exportWrapper->setEntry(0, "Export Route");
|
||||
|
||||
deleteWrapper->setLcd(this->lcd);
|
||||
deleteWrapper->setMinMax(0, 100);
|
||||
deleteWrapper->setMinMax(0, MenuRoute::maxRouteNumber);
|
||||
deleteWrapper->setPrintParentMenu(false);
|
||||
deleteWrapper->setEntry(0, "Delete Route");
|
||||
|
||||
@@ -114,13 +153,15 @@ void MenuRoute::init() {
|
||||
this->mainMenu->addEntry(new MenuAction("Delete", deleteWrapper));
|
||||
}
|
||||
|
||||
void MenuRoute::importRoute(uint8_t routeNumber) {
|
||||
void MenuRoute::importRoute(uint8_t routeNumber)
|
||||
{
|
||||
this->blockInput = true;
|
||||
|
||||
String lineOne = "";
|
||||
String lineTwo = "";
|
||||
|
||||
if (WiFi.status() != WL_CONNECTED) {
|
||||
if (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
lineOne = "Not connected to";
|
||||
lineTwo = "the WiFi.";
|
||||
this->print(lineOne, lineTwo);
|
||||
@@ -128,7 +169,8 @@ void MenuRoute::importRoute(uint8_t routeNumber) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE) {
|
||||
if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE)
|
||||
{
|
||||
lineOne = "Not enough mem";
|
||||
lineTwo = "for Json obj";
|
||||
this->print(lineOne, lineTwo);
|
||||
@@ -149,14 +191,19 @@ void MenuRoute::importRoute(uint8_t routeNumber) {
|
||||
lineTwo = "Code: ";
|
||||
|
||||
if (httpResponseCode == 202)
|
||||
{
|
||||
deserializeJson(doc, http.getStream());
|
||||
}
|
||||
else
|
||||
{
|
||||
lineOne = "HTTP Error";
|
||||
}
|
||||
|
||||
lineTwo.concat(httpResponseCode);
|
||||
this->print(lineOne, lineTwo);
|
||||
|
||||
if (httpResponseCode <= 0) {
|
||||
if (httpResponseCode <= 0)
|
||||
{
|
||||
this->blockInput = false;
|
||||
return;
|
||||
}
|
||||
@@ -164,7 +211,8 @@ void MenuRoute::importRoute(uint8_t routeNumber) {
|
||||
uint16_t totalPoints = doc["amountPoints"];
|
||||
|
||||
this->route->clear();
|
||||
for (uint16_t i = 0; i < totalPoints; i++) {
|
||||
for (uint16_t i = 0; i < totalPoints; i++)
|
||||
{
|
||||
Point::Coordinates coords;
|
||||
coords.lat = doc["points"][i][0].as<double>();
|
||||
coords.lon = doc["points"][i][1].as<double>();
|
||||
@@ -175,14 +223,16 @@ void MenuRoute::importRoute(uint8_t routeNumber) {
|
||||
http.end();
|
||||
}
|
||||
|
||||
void MenuRoute::exportRoute(uint8_t routeNumber) {
|
||||
void MenuRoute::exportRoute(uint8_t routeNumber)
|
||||
{
|
||||
this->blockInput = true;
|
||||
uint16_t totalPoints = this->route->getRouteInfo().totalPoints;
|
||||
|
||||
String lineOne = "";
|
||||
String lineTwo = "";
|
||||
|
||||
if (WiFi.status() != WL_CONNECTED) {
|
||||
if (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
lineOne = "Not connected to";
|
||||
lineTwo = "the WiFi.";
|
||||
this->print(lineOne, lineTwo);
|
||||
@@ -190,7 +240,8 @@ void MenuRoute::exportRoute(uint8_t routeNumber) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE) {
|
||||
if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE)
|
||||
{
|
||||
lineOne = "Not enough mem";
|
||||
lineTwo = "for Json obj";
|
||||
this->print(lineOne, lineTwo);
|
||||
@@ -205,7 +256,8 @@ void MenuRoute::exportRoute(uint8_t routeNumber) {
|
||||
Point::Coordinates coords = this->route->startRoute().getCoordinates();
|
||||
doc["points"][0][0] = coords.lat;
|
||||
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();
|
||||
doc["points"][i][0] = coords.lat;
|
||||
doc["points"][i][1] = coords.lon;
|
||||
@@ -221,9 +273,13 @@ void MenuRoute::exportRoute(uint8_t routeNumber) {
|
||||
int httpResponseCode = http.POST(jsonData);
|
||||
|
||||
if (httpResponseCode == 201)
|
||||
{
|
||||
lineOne = "Export complete";
|
||||
}
|
||||
else
|
||||
{
|
||||
lineOne = "HTTP Error";
|
||||
}
|
||||
lineTwo = "Code: ";
|
||||
lineTwo.concat(httpResponseCode);
|
||||
this->print(lineOne, lineTwo);
|
||||
@@ -232,13 +288,15 @@ void MenuRoute::exportRoute(uint8_t routeNumber) {
|
||||
http.end();
|
||||
}
|
||||
|
||||
void MenuRoute::deleteRoute(uint8_t routeNumber) {
|
||||
void MenuRoute::deleteRoute(uint8_t routeNumber)
|
||||
{
|
||||
this->blockInput = true;
|
||||
|
||||
String lineOne = "";
|
||||
String lineTwo = "";
|
||||
|
||||
if (WiFi.status() != WL_CONNECTED) {
|
||||
if (WiFi.status() != WL_CONNECTED)
|
||||
{
|
||||
lineOne = "Not connected to";
|
||||
lineTwo = "the WiFi.";
|
||||
this->print(lineOne, lineTwo);
|
||||
@@ -246,7 +304,8 @@ void MenuRoute::deleteRoute(uint8_t routeNumber) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE) {
|
||||
if (ESP.getMaxAllocHeap() < JSON_DOCUMENT_SIZE_ROUTE)
|
||||
{
|
||||
lineOne = "Not enough mem";
|
||||
lineTwo = "for Json obj";
|
||||
this->print(lineOne, lineTwo);
|
||||
@@ -267,9 +326,13 @@ void MenuRoute::deleteRoute(uint8_t routeNumber) {
|
||||
lineTwo = "Code: ";
|
||||
|
||||
if (httpResponseCode == 202)
|
||||
{
|
||||
deserializeJson(doc, http.getStream());
|
||||
}
|
||||
else
|
||||
{
|
||||
lineOne = "HTTP Error";
|
||||
}
|
||||
|
||||
lineTwo.concat(httpResponseCode);
|
||||
this->print(lineOne, lineTwo);
|
||||
@@ -278,29 +341,37 @@ void MenuRoute::deleteRoute(uint8_t routeNumber) {
|
||||
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->print("Currente route", "deleted...");
|
||||
}
|
||||
|
||||
MenuRouteWrapper::MenuRouteWrapper(MenuRoute* menuRoute, DataFunction dataFunction) {
|
||||
this->menuRoute = menuRoute;
|
||||
this->dataFunction = dataFunction;
|
||||
MenuRouteWrapper::MenuRouteWrapper(MenuRoute *menuRoute, DataFunction dataFunction)
|
||||
: menuRoute {menuRoute}, dataFunction {dataFunction}
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MenuRouteWrapper::action(int16_t* values, uint8_t length) {
|
||||
if (length < 1) {
|
||||
void MenuRouteWrapper::action(int16_t *values, uint8_t length)
|
||||
{
|
||||
if (length < 1)
|
||||
{
|
||||
std::cout << "Error in MenuRouteWrapper::action" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (values[0] < 0)
|
||||
{
|
||||
values[0] = 0;
|
||||
}
|
||||
|
||||
if (values[0] > UINT8_MAX)
|
||||
{
|
||||
values[0] = UINT8_MAX;
|
||||
}
|
||||
|
||||
(this->menuRoute->*this->dataFunction)(values[0]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -126,6 +126,12 @@ class MenuRoute : public MenuControl {
|
||||
|
||||
bool isInit = 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"
|
||||
|
||||
MenuTestMode::MenuTestMode(DriveManager* driveManager) {
|
||||
this->driveManager = driveManager;
|
||||
MenuTestMode::MenuTestMode(DriveManager* driveManager)
|
||||
: driveManager {driveManager}
|
||||
{
|
||||
}
|
||||
|
||||
MenuTestMode::~MenuTestMode() {
|
||||
@@ -30,73 +31,77 @@ void MenuTestMode::printMenu() {
|
||||
}
|
||||
|
||||
void MenuTestMode::down() {
|
||||
if (this->checkInput())
|
||||
if (this->checkInput()) {
|
||||
this->mainMenu->down();
|
||||
}
|
||||
}
|
||||
|
||||
void MenuTestMode::up() {
|
||||
if (this->checkInput())
|
||||
if (this->checkInput()) {
|
||||
this->mainMenu->up();
|
||||
}
|
||||
}
|
||||
|
||||
void MenuTestMode::right() {
|
||||
if (this->checkInput())
|
||||
if (this->checkInput()) {
|
||||
this->mainMenu->right();
|
||||
}
|
||||
}
|
||||
|
||||
void MenuTestMode::left() {
|
||||
if (this->mainMenu->isInSubmenu())
|
||||
if (this->checkInput())
|
||||
if (this->checkInput()) {
|
||||
this->mainMenu->left();
|
||||
}
|
||||
else {
|
||||
this->testMode->abortManeuver();
|
||||
this->mainMenu->left();
|
||||
}
|
||||
else
|
||||
else {
|
||||
this->parentMenu->printMenu();
|
||||
}
|
||||
}
|
||||
|
||||
void MenuTestMode::yes() {
|
||||
if (this->checkInput())
|
||||
if (this->checkInput()) {
|
||||
this->mainMenu->yes();
|
||||
}
|
||||
}
|
||||
|
||||
void MenuTestMode::no() {
|
||||
if (this->mainMenu->isInSubmenu())
|
||||
if (this->mainMenu->isInSubmenu()) {
|
||||
if (this->checkInput())
|
||||
this->mainMenu->no();
|
||||
else {
|
||||
this->testMode->abortManeuver();
|
||||
this->mainMenu->no();
|
||||
}
|
||||
else
|
||||
this->left();
|
||||
}}
|
||||
else{
|
||||
this->left();}
|
||||
}
|
||||
|
||||
void MenuTestMode::init() {
|
||||
this->testMode = new TestMode();
|
||||
this->driveManager->changeModus(this->testMode);
|
||||
|
||||
this->testMode->setSpeeds(DrivingSpeeds{1, 8});
|
||||
|
||||
auto dummy = []() {
|
||||
std::cout << "Dummy in Action" <<std::endl;
|
||||
};
|
||||
|
||||
// Create menu
|
||||
this->mainMenu = new Menu;
|
||||
auto engineMenu = new Menu;
|
||||
auto lightMenu = new Menu;
|
||||
auto encoderMenu = new Menu;
|
||||
auto *engineMenu = new Menu;
|
||||
auto *lightMenu = new Menu;
|
||||
auto *encoderMenu = new Menu;
|
||||
// Sound
|
||||
// Ping google
|
||||
|
||||
auto drivingMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::drive));
|
||||
auto engineLeftMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::leftEngine));
|
||||
auto engineRightMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::rightEngine));
|
||||
auto engineBothMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::bothEngine));
|
||||
auto encoderLeftMenu = new SpeedometerTest(this->testMode->getSpeedometerLeft());
|
||||
auto encoderRightMenu = new SpeedometerTest(this->testMode->getSpeedometerRight());
|
||||
auto *drivingMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::drive));
|
||||
auto *engineLeftMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::leftEngine));
|
||||
auto *engineRightMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::rightEngine));
|
||||
auto *engineBothMenu = new MenuIntInput(2, new MenuTestModeWrapper(this, &TestMode::bothEngine));
|
||||
auto *encoderLeftMenu = new SpeedometerTest(this->testMode->getSpeedometerLeft());
|
||||
auto *encoderRightMenu = new SpeedometerTest(this->testMode->getSpeedometerRight());
|
||||
|
||||
|
||||
// Set menus on LCD
|
||||
@@ -112,47 +117,52 @@ void MenuTestMode::init() {
|
||||
encoderRightMenu->setLcd(this->lcd);
|
||||
|
||||
// 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->setMinMaxSteps(0, -1000, 1000, 25);
|
||||
drivingMenu->setMinMaxSteps(0, -1000, 1000, steps * 5);
|
||||
drivingMenu->setEntry(1, "Degree");
|
||||
drivingMenu->setMinMaxSteps(1, -360, 360, 15);
|
||||
drivingMenu->setMinMaxSteps(1, -degreeMax, degreeMax, steps * 3);
|
||||
drivingMenu->setPrintParentMenu(false);
|
||||
engineLeftMenu->setEntry(0, "Percentage");
|
||||
engineLeftMenu->setMinMaxSteps(0, -100, 100, 5);
|
||||
engineLeftMenu->setEntry(1, "Seconds", 5);
|
||||
engineLeftMenu->setMinMaxSteps(1, 0, 120, 1);
|
||||
engineLeftMenu->setMinMaxSteps(0, -percentMax, percentMax, steps);
|
||||
engineLeftMenu->setEntry(1, "Seconds", steps);
|
||||
engineLeftMenu->setMinMaxSteps(1, 0, secondsMax, 1);
|
||||
engineLeftMenu->setPrintParentMenu(false);
|
||||
engineRightMenu->setEntry(0, "Percentage");
|
||||
engineRightMenu->setMinMaxSteps(0, -100, 100, 5);
|
||||
engineRightMenu->setEntry(1, "Seconds", 5);
|
||||
engineRightMenu->setMinMaxSteps(1, 0, 120, 1);
|
||||
engineRightMenu->setMinMaxSteps(0, -percentMax, percentMax, steps);
|
||||
engineRightMenu->setEntry(1, "Seconds", steps);
|
||||
engineRightMenu->setMinMaxSteps(1, 0, secondsMax, 1);
|
||||
engineRightMenu->setPrintParentMenu(false);
|
||||
engineBothMenu->setEntry(0, "Percentage");
|
||||
engineBothMenu->setMinMaxSteps(0, -100, 100, 5);
|
||||
engineBothMenu->setEntry(1, "Seconds", 5);
|
||||
engineBothMenu->setMinMaxSteps(1, 0, 120, 1);
|
||||
engineBothMenu->setMinMaxSteps(0, -percentMax, percentMax, steps);
|
||||
engineBothMenu->setEntry(1, "Seconds", steps);
|
||||
engineBothMenu->setMinMaxSteps(1, 0, secondsMax, 1);
|
||||
engineBothMenu->setPrintParentMenu(false);
|
||||
|
||||
|
||||
// Entrys for the menus
|
||||
MenuAction* engineAction = new MenuAction("Engine", engineMenu);
|
||||
MenuAction* engineLeftAction = new MenuAction("Left", engineLeftMenu);
|
||||
MenuAction* engineRightAction = new MenuAction("Right", engineRightMenu);
|
||||
MenuAction* engineBothAction = new MenuAction("Both", engineBothMenu);
|
||||
auto *engineAction = new MenuAction("Engine", engineMenu);
|
||||
auto *engineLeftAction = new MenuAction("Left", engineLeftMenu);
|
||||
auto *engineRightAction = new MenuAction("Right", engineRightMenu);
|
||||
auto *engineBothAction = new MenuAction("Both", engineBothMenu);
|
||||
|
||||
MenuAction* drivingAction = new MenuAction("Driving", drivingMenu);
|
||||
auto *drivingAction = new MenuAction("Driving", drivingMenu);
|
||||
|
||||
MenuAction* encoderAction = new MenuAction("Encoder", encoderMenu);
|
||||
MenuAction* encoderLeftAction = new MenuAction("Left", encoderLeftMenu);
|
||||
MenuAction* encoderRightAction = new MenuAction("Right", encoderRightMenu);
|
||||
auto *encoderAction = new MenuAction("Encoder", encoderMenu);
|
||||
auto *encoderLeftAction = new MenuAction("Left", encoderLeftMenu);
|
||||
auto *encoderRightAction = new MenuAction("Right", encoderRightMenu);
|
||||
|
||||
MenuAction* lightAction = new MenuAction("Light", lightMenu);
|
||||
MenuAction* lightFlashAction = new MenuAction("Flash", dummy);
|
||||
MenuAction* lightFadeAction = new MenuAction("Fade", dummy);
|
||||
MenuAction* lightRedAction = new MenuAction("Red", dummy);
|
||||
MenuAction* lightGreenAction = new MenuAction("Green", dummy);
|
||||
MenuAction* lightBlueAction = new MenuAction("Blue", dummy);
|
||||
MenuAction* lightOffAction = new MenuAction("Off", dummy);
|
||||
auto *lightAction = new MenuAction("Light", lightMenu);
|
||||
auto *lightFlashAction = new MenuAction("Flash", dummy);
|
||||
auto *lightFadeAction = new MenuAction("Fade", dummy);
|
||||
auto *lightRedAction = new MenuAction("Red", dummy);
|
||||
auto *lightGreenAction = new MenuAction("Green", dummy);
|
||||
auto *lightBlueAction = new MenuAction("Blue", dummy);
|
||||
auto *lightOffAction = new MenuAction("Off", dummy);
|
||||
|
||||
// Add entrys to the menus
|
||||
this->mainMenu->addEntry(engineAction);
|
||||
@@ -176,11 +186,11 @@ void MenuTestMode::init() {
|
||||
}
|
||||
|
||||
void MenuTestMode::update() {
|
||||
if (this->maneuverInAction)
|
||||
if (this->maneuverInAction) {
|
||||
if (millis() - this->lastUpdateTime > updateDelay) {
|
||||
this->printManeuverTime();
|
||||
this->lastUpdateTime = millis();
|
||||
}
|
||||
}}
|
||||
}
|
||||
|
||||
bool MenuTestMode::checkInput() {
|
||||
@@ -190,8 +200,9 @@ bool MenuTestMode::checkInput() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this->maneuverInAction)
|
||||
if (this->maneuverInAction) {
|
||||
this->maneuverInAction = false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -209,16 +220,18 @@ void MenuTestMode::printManeuverTime() {
|
||||
}
|
||||
}
|
||||
|
||||
MenuTestModeWrapper::MenuTestModeWrapper(MenuTestMode* menu, TestModeFunctionSingle testModeFunction) {
|
||||
this->menu = menu;
|
||||
this->testMode = this->menu->getTestMode();
|
||||
this->testModeFunctionSingle = testModeFunction;
|
||||
MenuTestModeWrapper::MenuTestModeWrapper(MenuTestMode* menu, TestModeFunctionSingle testModeFunction)
|
||||
: menu {menu},
|
||||
testModeFunctionSingle {testModeFunction},
|
||||
testMode {menu->getTestMode()}
|
||||
{
|
||||
}
|
||||
|
||||
MenuTestModeWrapper::MenuTestModeWrapper(MenuTestMode* menu, TestModeFunctionDouble testModeFunction) {
|
||||
this->menu = menu;
|
||||
this->testMode = this->menu->getTestMode();
|
||||
this->testModeFunctionDouble = testModeFunction;
|
||||
MenuTestModeWrapper::MenuTestModeWrapper(MenuTestMode* menu, TestModeFunctionDouble testModeFunction)
|
||||
: menu {menu},
|
||||
testModeFunctionDouble {testModeFunction},
|
||||
testMode {menu->getTestMode()}
|
||||
{
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (length == 2 && this->testModeFunctionDouble)
|
||||
if (length == 2 && static_cast<bool>(this->testModeFunctionDouble)) {
|
||||
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]);
|
||||
}
|
||||
|
||||
if (res) {
|
||||
this->menu->printManeuverTime();
|
||||
|
||||
@@ -70,8 +70,8 @@ class MenuTestMode : public MenuControl {
|
||||
bool checkInput();
|
||||
|
||||
DriveManager* driveManager;
|
||||
TestMode* testMode;
|
||||
Menu* mainMenu;
|
||||
TestMode* testMode = nullptr;
|
||||
Menu* mainMenu = nullptr;
|
||||
|
||||
bool isInit = false;
|
||||
bool maneuverInAction = false;
|
||||
|
||||
@@ -11,8 +11,9 @@
|
||||
|
||||
#include "speedometerTest.h"
|
||||
|
||||
SpeedometerTest::SpeedometerTest(Speedometer* speedometer) {
|
||||
this->speedometer = speedometer;
|
||||
SpeedometerTest::SpeedometerTest(Speedometer* speedometer)
|
||||
: speedometer {speedometer}
|
||||
{
|
||||
this->speedometer->setDirection(Speedometer::Forward);
|
||||
}
|
||||
|
||||
@@ -46,8 +47,9 @@ void SpeedometerTest::left() {
|
||||
}
|
||||
|
||||
void SpeedometerTest::no() {
|
||||
if (this->state == State::Running)
|
||||
if (this->state == State::Running){
|
||||
speedometer->calibrationMeasurementStop();
|
||||
}
|
||||
|
||||
this->state = State::Off;
|
||||
this->parentMenu->printMenu();
|
||||
|
||||
@@ -11,27 +11,28 @@
|
||||
|
||||
#include "menuDriveMode.h"
|
||||
|
||||
MenuDriveMode::MenuDriveMode(DriveManager* driveManager) {
|
||||
this->driveManager = driveManager;
|
||||
MenuDriveMode::MenuDriveMode(DriveManager* driveManager)
|
||||
: driveManager {driveManager}
|
||||
{
|
||||
}
|
||||
|
||||
void MenuDriveMode::left() {
|
||||
if (this->activeMenu) {
|
||||
if (this->activeMenu)
|
||||
if (static_cast<bool>(this->activeMenu)) {
|
||||
if (static_cast<bool>(this->activeMenu)) {
|
||||
this->activeMenu->left();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this->firstPrint = true;
|
||||
this->configureOnLeave();
|
||||
if (this->menuSpeed)
|
||||
delete this->menuSpeed;
|
||||
this->driveManager->changeModus();
|
||||
MenuInformationSites::left();
|
||||
}
|
||||
|
||||
void MenuDriveMode::right() {
|
||||
if (this->activeMenu) {
|
||||
if (static_cast<bool>(this->activeMenu)) {
|
||||
this->activeMenu->right();
|
||||
return;
|
||||
}
|
||||
@@ -39,7 +40,7 @@ void MenuDriveMode::right() {
|
||||
}
|
||||
|
||||
void MenuDriveMode::up() {
|
||||
if (this->activeMenu) {
|
||||
if (static_cast<bool>(this->activeMenu)) {
|
||||
this->activeMenu->up();
|
||||
return;
|
||||
}
|
||||
@@ -47,7 +48,7 @@ void MenuDriveMode::up() {
|
||||
}
|
||||
|
||||
void MenuDriveMode::down() {
|
||||
if (this->activeMenu) {
|
||||
if (static_cast<bool>(this->activeMenu)) {
|
||||
this->activeMenu->down();
|
||||
return;
|
||||
}
|
||||
@@ -55,7 +56,7 @@ void MenuDriveMode::down() {
|
||||
}
|
||||
|
||||
void MenuDriveMode::yes() {
|
||||
if (this->activeMenu) {
|
||||
if (static_cast<bool>(this->activeMenu)) {
|
||||
this->activeMenu->yes();
|
||||
return;
|
||||
}
|
||||
@@ -63,7 +64,7 @@ void MenuDriveMode::yes() {
|
||||
}
|
||||
|
||||
void MenuDriveMode::no() {
|
||||
if (this->activeMenu) {
|
||||
if (static_cast<bool>(this->activeMenu)) {
|
||||
this->activeMenu->no();
|
||||
return;
|
||||
}
|
||||
@@ -75,7 +76,7 @@ void MenuDriveMode::prepareReenterMenu() {
|
||||
}
|
||||
|
||||
void MenuDriveMode::printMenu() {
|
||||
if (this->activeMenu) {
|
||||
if (static_cast<bool>(this->activeMenu)) {
|
||||
this->activeMenu->printMenu();
|
||||
return;
|
||||
}
|
||||
@@ -88,11 +89,12 @@ void MenuDriveMode::init() {
|
||||
}
|
||||
|
||||
void MenuDriveMode::activateSpeedMenu() {
|
||||
if (!this->driveManager->isActive())
|
||||
if (!this->driveManager->isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
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->setEntry(0, "x m/s e-1", driveManager->getDrivingSpeedsRef().x * 10);
|
||||
@@ -112,8 +114,9 @@ void MenuDriveMode::enterSensorMenu() {
|
||||
}
|
||||
|
||||
void MenuDriveMode::enterMenu() {
|
||||
if (!this->activeMenu)
|
||||
if (!static_cast<bool>(this->activeMenu)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->activeMenu->printMenu();
|
||||
this->activeMenu->setParentMenu(this);
|
||||
|
||||
@@ -12,37 +12,42 @@
|
||||
#include "driveModi/Modi/Autopilot/autopilot.h"
|
||||
#include "autopilot.h"
|
||||
|
||||
DirectionChangeSignal::DirectionChangeSignal(Autopilot* pilot) {
|
||||
this->pilot = pilot;
|
||||
DirectionChangeSignal::DirectionChangeSignal(Autopilot *pilot)
|
||||
: pilot {pilot}
|
||||
{
|
||||
this->action();
|
||||
}
|
||||
|
||||
DirectionChangeSignal::~DirectionChangeSignal() {
|
||||
DirectionChangeSignal::~DirectionChangeSignal()
|
||||
{
|
||||
CalcAzimuth *calcAzimuth = pilot->getSensorData()->getCalcCompass();
|
||||
if (calcAzimuth)
|
||||
if (static_cast<bool>(calcAzimuth))
|
||||
{
|
||||
calcAzimuth->disableCalcAzimuth();
|
||||
}
|
||||
}
|
||||
|
||||
void DirectionChangeSignal::action() {
|
||||
void DirectionChangeSignal::action()
|
||||
{
|
||||
CalcAzimuth *calcAzimuth = pilot->getSensorData()->getCalcCompass();
|
||||
if (calcAzimuth)
|
||||
if (static_cast<bool>(calcAzimuth))
|
||||
{
|
||||
calcAzimuth->drivingDirectionChange(pilot->getSensorData()->getCurrentPos());
|
||||
}
|
||||
|
||||
|
||||
Autopilot::Autopilot() {
|
||||
|
||||
}
|
||||
|
||||
Autopilot::~Autopilot() {
|
||||
Autopilot::~Autopilot()
|
||||
{
|
||||
delete this->directionChangeSignal;
|
||||
// this->navigation->getNTRIPClient()->setActivated(false);
|
||||
}
|
||||
|
||||
void Autopilot::run() {
|
||||
void Autopilot::run()
|
||||
{
|
||||
this->routeInfo = this->navigation->getRouteInfo();
|
||||
|
||||
switch (this->state) {
|
||||
switch (this->state)
|
||||
{
|
||||
case State::InsufficientAccuracy:
|
||||
this->askNavigationForOrder();
|
||||
return;
|
||||
@@ -61,8 +66,9 @@ void Autopilot::run() {
|
||||
case State::GetToStartPoint:
|
||||
ManualControl::run();
|
||||
this->askNavigationForOrder();
|
||||
if (this->routeInfo.currentPoint >= 2)
|
||||
if (this->routeInfo.currentPoint >= 2){
|
||||
this->state = State::SelfDrivingAvailable;
|
||||
}
|
||||
break;
|
||||
|
||||
case State::SelfDrivingAvailable:
|
||||
@@ -83,8 +89,9 @@ void Autopilot::run() {
|
||||
break;
|
||||
|
||||
case State::TargetReached:
|
||||
if (this->loopMode)
|
||||
if (this->loopMode){
|
||||
this->restartLoop();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -92,31 +99,42 @@ void Autopilot::run() {
|
||||
}
|
||||
}
|
||||
|
||||
void Autopilot::restart() {
|
||||
void Autopilot::restart()
|
||||
{
|
||||
this->init();
|
||||
}
|
||||
|
||||
bool Autopilot::shouldUpdate() {
|
||||
if (this->updateDisplay) {
|
||||
bool Autopilot::shouldUpdate()
|
||||
{
|
||||
if (this->updateDisplay)
|
||||
{
|
||||
this->updateDisplay = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Autopilot::testRotate(int16_t degree) {
|
||||
if (!degree)
|
||||
void Autopilot::testRotate(int16_t degree)
|
||||
{
|
||||
if (!static_cast<bool>(degree))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->courseCorrection.correction = degree;
|
||||
this->beginRotate();
|
||||
}
|
||||
|
||||
void Autopilot::init() {
|
||||
void Autopilot::init()
|
||||
{
|
||||
if (this->navigation->startNavigation())
|
||||
{
|
||||
this->state = State::NavigationStarted;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->state = State::NoRoute;
|
||||
}
|
||||
this->routeInfo = this->navigation->getRouteInfo();
|
||||
this->sensorData->getNtripClient()->setAutoReconnect(true);
|
||||
|
||||
@@ -127,15 +145,20 @@ void Autopilot::init() {
|
||||
this->updateDisplay = true;
|
||||
}
|
||||
|
||||
void Autopilot::drive() {
|
||||
void Autopilot::drive()
|
||||
{
|
||||
DrivingSpeeds speeds = {0, 0};
|
||||
if (this->courseCorrection.distance >= this->minRemainingDistance)
|
||||
{
|
||||
speeds.x = this->maxSpeeds.x;
|
||||
}
|
||||
this->moveControl->setSpeeds(speeds);
|
||||
}
|
||||
|
||||
void Autopilot::beginRotate() {
|
||||
if (this->state != State::SelfDrivingRotate) {
|
||||
void Autopilot::beginRotate()
|
||||
{
|
||||
if (this->state != State::SelfDrivingRotate)
|
||||
{
|
||||
this->lastState = this->state;
|
||||
this->state = State::SelfDrivingRotate;
|
||||
this->rotationAimAzimuth = this->getSensorData()->getRealAzimuth() + this->courseCorrection.correction;
|
||||
@@ -143,35 +166,40 @@ void Autopilot::beginRotate() {
|
||||
|
||||
DrivingSpeeds speeds = {0, 0};
|
||||
if (this->courseCorrection.correction > 0)
|
||||
{
|
||||
speeds.rot = -this->maxSpeeds.rot;
|
||||
}
|
||||
else
|
||||
{
|
||||
speeds.rot = this->maxSpeeds.rot;
|
||||
}
|
||||
|
||||
this->moveControl->setSpeeds(speeds);
|
||||
}
|
||||
}
|
||||
|
||||
void Autopilot::rotate() {
|
||||
if (abs(this->getSensorData()->getRealAzimuth() - this->rotationAimAzimuth) < this->maxCourseDeviationBeforeAct) {
|
||||
void Autopilot::rotate()
|
||||
{
|
||||
if (abs(this->getSensorData()->getRealAzimuth() - this->rotationAimAzimuth) < this->maxCourseDeviationBeforeAct)
|
||||
{
|
||||
this->endRotate();
|
||||
return;
|
||||
}
|
||||
|
||||
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())))
|
||||
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->endRotate();
|
||||
std::cout << "Autopilot::rotate: Rover rotated too far" << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void Autopilot::endRotate() {
|
||||
void Autopilot::endRotate()
|
||||
{
|
||||
if (this->state != State::SelfDrivingRotate)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this->state = this->lastState;
|
||||
this->sensorData->getCalcCompass()->drivingDirectionChange(this->sensorData->getCurrentPos());
|
||||
@@ -180,24 +208,33 @@ void Autopilot::endRotate() {
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
||||
}
|
||||
|
||||
void Autopilot::checkButtonInput() {
|
||||
if (ControlPadButton::isControlPadButtonPressed(this->input, ControlPadButton::PadButton::Action)
|
||||
&& millis() - this->lastAutopilotChangeMillis > this->autopilotChangeDelayMillis) {
|
||||
void Autopilot::checkButtonInput()
|
||||
{
|
||||
if (ControlPadButton::isControlPadButtonPressed(this->input, ControlPadButton::PadButton::Action) && millis() - this->lastAutopilotChangeMillis > this->autopilotChangeDelayMillis)
|
||||
{
|
||||
|
||||
if (this->state == State::SelfDrivingAvailable)
|
||||
{
|
||||
this->state = State::SelfDriving;
|
||||
}
|
||||
else if (this->state == State::SelfDriving || this->state == State::SelfDrivingRotate)
|
||||
{
|
||||
this->state = State::SelfDrivingAvailable;
|
||||
}
|
||||
else if (this->state == State::NavigationStarted)
|
||||
{
|
||||
this->state = State::GetToStartPoint;
|
||||
}
|
||||
this->updateDisplay = true;
|
||||
this->lastAutopilotChangeMillis = millis();
|
||||
}
|
||||
}
|
||||
|
||||
void Autopilot::askNavigationForOrder() {
|
||||
void Autopilot::askNavigationForOrder()
|
||||
{
|
||||
this->lastOrderStatus = this->navigation->getCourseCorrection(this->courseCorrection);
|
||||
switch (this->lastOrderStatus) {
|
||||
switch (this->lastOrderStatus)
|
||||
{
|
||||
case Navigation::Status::Complete:
|
||||
this->state = State::TargetReached;
|
||||
this->moveControl->setSpeed(0);
|
||||
@@ -205,8 +242,9 @@ void Autopilot::askNavigationForOrder() {
|
||||
break;
|
||||
|
||||
case Navigation::Status::InsufficientAccuracy:
|
||||
if (this->state == State::InsufficientAccuracy)
|
||||
if (this->state == State::InsufficientAccuracy){
|
||||
break;
|
||||
}
|
||||
this->lastState = this->state;
|
||||
this->state = State::InsufficientAccuracy;
|
||||
this->moveControl->setSpeed(0);
|
||||
@@ -214,13 +252,15 @@ void Autopilot::askNavigationForOrder() {
|
||||
break;
|
||||
|
||||
case Navigation::Status::Unchanged:
|
||||
if (this->state == State::InsufficientAccuracy)
|
||||
if (this->state == State::InsufficientAccuracy){
|
||||
this->state = this->lastState;
|
||||
}
|
||||
break;
|
||||
|
||||
case Navigation::Status::Updated:
|
||||
if (this->state == State::InsufficientAccuracy)
|
||||
if (this->state == State::InsufficientAccuracy){
|
||||
this->state = this->lastState;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -228,17 +268,25 @@ void Autopilot::askNavigationForOrder() {
|
||||
}
|
||||
}
|
||||
|
||||
void Autopilot::selfDriving() {
|
||||
void Autopilot::selfDriving()
|
||||
{
|
||||
if (this->state != State::SelfDriving)
|
||||
{
|
||||
return;
|
||||
|
||||
if (abs(this->courseCorrection.correction) >= this->maxCourseDeviationBeforeAct)
|
||||
this->beginRotate();
|
||||
else
|
||||
this->drive();
|
||||
}
|
||||
|
||||
void Autopilot::restartLoop() {
|
||||
if (abs(this->courseCorrection.correction) >= this->maxCourseDeviationBeforeAct)
|
||||
{
|
||||
this->beginRotate();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->drive();
|
||||
}
|
||||
}
|
||||
|
||||
void Autopilot::restartLoop()
|
||||
{
|
||||
this->navigation->startNavigation();
|
||||
this->state = State::SelfDriving;
|
||||
this->routeInfo = this->navigation->getRouteInfo();
|
||||
@@ -246,7 +294,8 @@ void Autopilot::restartLoop() {
|
||||
this->updateDisplay = true;
|
||||
}
|
||||
|
||||
void Autopilot::afterActivate() {
|
||||
void Autopilot::afterActivate()
|
||||
{
|
||||
this->setInputMode(ManualControl::InputMode::Digital);
|
||||
this->directionChangeSignal = new DirectionChangeSignal(this);
|
||||
this->setDirectionChangeCallback(this->directionChangeSignal);
|
||||
|
||||
@@ -41,14 +41,6 @@ class Autopilot : public ManualControl {
|
||||
TargetReached
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Construct a new Autopilot object
|
||||
*
|
||||
* @param moveControl for ManualControl
|
||||
* @param navigation for route instructions
|
||||
*/
|
||||
Autopilot();
|
||||
|
||||
/**
|
||||
* @brief Destroy the Autopilot object
|
||||
*
|
||||
@@ -104,13 +96,13 @@ class Autopilot : public ManualControl {
|
||||
void restartLoop();
|
||||
void afterActivate() override;
|
||||
|
||||
Navigation* navigation;
|
||||
CourseCorrection courseCorrection;
|
||||
RouteInfo routeInfo;
|
||||
Navigation* navigation = nullptr;
|
||||
CourseCorrection courseCorrection{0, 0};
|
||||
RouteInfo routeInfo{0, 0};
|
||||
State state = State::None;
|
||||
State lastState = State::None;
|
||||
Navigation::Status lastOrderStatus;
|
||||
DirectionChangeSignal* directionChangeSignal;
|
||||
DirectionChangeSignal* directionChangeSignal = nullptr;
|
||||
|
||||
bool updateDisplay = false;
|
||||
bool loopMode = false;
|
||||
@@ -119,7 +111,7 @@ class Autopilot : public ManualControl {
|
||||
uint16_t autopilotChangeDelayMillis = 500;
|
||||
uint32_t lastAutopilotChangeMillis = 0;
|
||||
|
||||
int16_t rotationAimAzimuth;
|
||||
int16_t rotationAimAzimuth = 0;
|
||||
|
||||
double minRemainingDistance = 0.25;
|
||||
};
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
|
||||
void CalibrateCompassM::setCalibrateCompass(CalibrateCompass *caliCompass) {
|
||||
if (caliCompass) {
|
||||
if (static_cast<bool>(caliCompass)) {
|
||||
this->caliCompass = caliCompass;
|
||||
this->addChildComponent(this->caliCompass);
|
||||
} else if (this->caliCompass) {
|
||||
} else if (static_cast<bool>(this->caliCompass)) {
|
||||
this->removeChildComponent(this->caliCompass);
|
||||
this->caliCompass = caliCompass;
|
||||
}
|
||||
|
||||
@@ -12,19 +12,24 @@
|
||||
#include "driveModi/Modi/CaptureRoute/captureRoute.h"
|
||||
#include "captureRoute.h"
|
||||
|
||||
CaptureRoute::~CaptureRoute() {
|
||||
if (this->navigation)
|
||||
CaptureRoute::~CaptureRoute()
|
||||
{
|
||||
delete this->navigation;
|
||||
|
||||
if (this->sensorData->getNtripClient())
|
||||
if (static_cast<bool>(this->sensorData->getNtripClient()))
|
||||
{
|
||||
this->sensorData->getNtripClient()->setActivated(false);
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureRoute::run() {
|
||||
void CaptureRoute::run()
|
||||
{
|
||||
ManualControl::run();
|
||||
if (ControlPadButton::isControlPadButtonPressed(this->input, ControlPadButton::PadButton::Action)) {
|
||||
if (ControlPadButton::isControlPadButtonPressed(this->input, ControlPadButton::PadButton::Action))
|
||||
{
|
||||
this->status = this->navigation->addCurrentPosToRoute();
|
||||
if (this->status == Navigation::Status::Updated) {
|
||||
if (this->status == Navigation::Status::Updated)
|
||||
{
|
||||
this->lastSavedPoint = this->navigation->getCurrentPosition();
|
||||
this->routeInfo = navigation->getRouteInfo();
|
||||
this->updateDisplay = true;
|
||||
@@ -32,21 +37,27 @@ void CaptureRoute::run() {
|
||||
}
|
||||
}
|
||||
|
||||
void CaptureRoute::afterActivate() {
|
||||
void CaptureRoute::afterActivate()
|
||||
{
|
||||
this->navigation = new Navigation(this->sensorData);
|
||||
this->navigation->getRoute()->clear();
|
||||
this->sensorData->getNtripClient()->setAutoReconnect(true);
|
||||
this->routeInfo = navigation->getRouteInfo();
|
||||
}
|
||||
|
||||
double CaptureRoute::getDistanceToLastPoint() const {
|
||||
double CaptureRoute::getDistanceToLastPoint() const
|
||||
{
|
||||
if (!this->lastSavedPoint.isInit())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return this->lastSavedPoint.distanceTo(this->navigation->getCurrentPosition());
|
||||
}
|
||||
|
||||
bool CaptureRoute::shouldUpdate() {
|
||||
if (this->updateDisplay) {
|
||||
bool CaptureRoute::shouldUpdate()
|
||||
{
|
||||
if (this->updateDisplay)
|
||||
{
|
||||
this->updateDisplay = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
*/
|
||||
#include "manualControl.h"
|
||||
|
||||
void ManualControl::run() {
|
||||
switch (this->inputMode) {
|
||||
void ManualControl::run()
|
||||
{
|
||||
switch (this->inputMode)
|
||||
{
|
||||
case InputMode::Analog:
|
||||
this->analogControl();
|
||||
break;
|
||||
@@ -25,46 +27,66 @@ void ManualControl::run() {
|
||||
}
|
||||
}
|
||||
|
||||
void ManualControl::switchInputMode() {
|
||||
void ManualControl::switchInputMode()
|
||||
{
|
||||
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)
|
||||
int16_t x = this->input->x - 127;
|
||||
int16_t y = this->input->y - 127;
|
||||
|
||||
const int16_t xAxis = this->input->x - 127;
|
||||
const int16_t yAxis = this->input->y - 127;
|
||||
|
||||
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;
|
||||
this->moveControl->setRotationSpeed(y * value_per_step);
|
||||
this->moveControl->setRotationSpeed(yAxis * value_per_step);
|
||||
}
|
||||
|
||||
void ManualControl::digitalControl() {
|
||||
int16_t y = this->input->x - 127;
|
||||
int16_t x = this->input->y - 127;
|
||||
void ManualControl::digitalControl()
|
||||
{
|
||||
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);
|
||||
else if (y < -120)
|
||||
}
|
||||
else if (yAxis < -deadzone)
|
||||
{
|
||||
this->moveControl->setSpeed(this->maxSpeeds.rot);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->moveControl->setSpeed(0);
|
||||
}
|
||||
|
||||
if (x > 120)
|
||||
if (xAxis > deadzone)
|
||||
{
|
||||
this->moveControl->setRotationSpeed(this->maxSpeeds.rot);
|
||||
else if (x < -120)
|
||||
}
|
||||
else if (xAxis < -deadzone)
|
||||
{
|
||||
this->moveControl->setRotationSpeed(-this->maxSpeeds.rot);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->moveControl->setRotationSpeed(0);
|
||||
}
|
||||
|
||||
if (this->directionChangeWrapper && (x > 120 || x < -120))
|
||||
if (static_cast<bool>(this->directionChangeWrapper) && (xAxis > deadzone || xAxis < -deadzone))
|
||||
{
|
||||
this->lastLoopTurned = true;
|
||||
else if (this->lastLoopTurned) {
|
||||
if (this->directionChangeWrapper)
|
||||
}
|
||||
else if (this->lastLoopTurned)
|
||||
{
|
||||
if (static_cast<bool>(this->directionChangeWrapper))
|
||||
{
|
||||
this->directionChangeWrapper->action();
|
||||
}
|
||||
this->lastLoopTurned = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,14 +10,18 @@
|
||||
*/
|
||||
#include "testMode.h"
|
||||
|
||||
void TestMode::run() {
|
||||
if (this->maneuver == Maneuver::Turn) {
|
||||
void TestMode::run()
|
||||
{
|
||||
if (this->maneuver == Maneuver::Turn)
|
||||
{
|
||||
uint16_t delta = abs(this->azimuth - this->getSensorData()->getRealAzimuth());
|
||||
if (delta > this->degree)
|
||||
if (delta > this->degree) {
|
||||
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->abort = false;
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Stop);
|
||||
@@ -25,21 +29,26 @@ void TestMode::run() {
|
||||
}
|
||||
}
|
||||
|
||||
bool TestMode::drive(int16_t cm, int16_t degree) {
|
||||
if (this->busy)
|
||||
bool TestMode::drive(int16_t cmDistance, int16_t degree)
|
||||
{
|
||||
if (this->busy){
|
||||
return false;
|
||||
}
|
||||
|
||||
this->actionStart = millis();
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
||||
|
||||
if (cm == 0) {
|
||||
if (cmDistance == 0)
|
||||
{
|
||||
// Only left or right
|
||||
this->moveControl->setSpeed(0);
|
||||
|
||||
if (degree < 0)
|
||||
if (degree < 0){
|
||||
this->moveControl->setRotationSpeed(-this->maxSpeeds.rot);
|
||||
else if (degree > 0)
|
||||
}
|
||||
else if (degree > 0){
|
||||
this->moveControl->setRotationSpeed(this->maxSpeeds.rot);
|
||||
}
|
||||
|
||||
this->azimuth = this->getSensorData()->getRealAzimuth();
|
||||
this->degree = degree;
|
||||
@@ -47,29 +56,36 @@ bool TestMode::drive(int16_t cm, int16_t degree) {
|
||||
this->maneuverTime = 5 * 1000;
|
||||
this->busy = true;
|
||||
return true;
|
||||
|
||||
} else if (degree == 0) {
|
||||
}
|
||||
if (degree == 0)
|
||||
{
|
||||
// Only forward or backward
|
||||
this->moveControl->setRotationSpeed(0);
|
||||
|
||||
if (cm < 0)
|
||||
if (cmDistance < 0){
|
||||
this->moveControl->setSpeed(-this->maxSpeeds.x);
|
||||
else if (cm > 0)
|
||||
}
|
||||
else if (cmDistance > 0){
|
||||
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->maneuver = Maneuver::Drive;
|
||||
return true;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// forward or backward and left or right
|
||||
// TODO: Calculate roationspeed
|
||||
if (cm < 0)
|
||||
if (cmDistance < 0){
|
||||
this->moveControl->setSpeed(-this->maxSpeeds.x);
|
||||
else if (cm > 0)
|
||||
}
|
||||
else if (cmDistance > 0){
|
||||
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->maneuver = Maneuver::Drive;
|
||||
return true;
|
||||
@@ -79,8 +95,10 @@ bool TestMode::drive(int16_t cm, int16_t degree) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TestMode::leftEngine(int16_t powerPercentage, int16_t seconds) {
|
||||
if (this->engineInit(powerPercentage, seconds)) {
|
||||
bool TestMode::leftEngine(int16_t powerPercentage, int16_t seconds)
|
||||
{
|
||||
if (this->engineInit(powerPercentage, seconds))
|
||||
{
|
||||
this->moveControl->setRawPowerLeft(powerPercentage);
|
||||
this->maneuver = Maneuver::LeftEngine;
|
||||
std::cout << "TestMode::leftEngine" << std::endl;
|
||||
@@ -89,8 +107,10 @@ bool TestMode::leftEngine(int16_t powerPercentage, int16_t seconds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TestMode::rightEngine(int16_t powerPercentage, int16_t seconds) {
|
||||
if (this->engineInit(powerPercentage, seconds)) {
|
||||
bool TestMode::rightEngine(int16_t powerPercentage, int16_t seconds)
|
||||
{
|
||||
if (this->engineInit(powerPercentage, seconds))
|
||||
{
|
||||
this->moveControl->setRawPowerRight(powerPercentage);
|
||||
this->maneuver = Maneuver::RightEngine;
|
||||
return true;
|
||||
@@ -98,8 +118,10 @@ bool TestMode::rightEngine(int16_t powerPercentage, int16_t seconds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool TestMode::bothEngine(int16_t powerPercentage, int16_t seconds) {
|
||||
if (this->engineInit(powerPercentage, seconds)) {
|
||||
bool TestMode::bothEngine(int16_t powerPercentage, int16_t seconds)
|
||||
{
|
||||
if (this->engineInit(powerPercentage, seconds))
|
||||
{
|
||||
this->moveControl->setRawPowerLeft(powerPercentage);
|
||||
this->moveControl->setRawPowerRight(powerPercentage);
|
||||
this->maneuver = Maneuver::BothEngine;
|
||||
@@ -108,23 +130,30 @@ bool TestMode::bothEngine(int16_t powerPercentage, int16_t seconds) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void TestMode::abortManeuver() {
|
||||
void TestMode::abortManeuver()
|
||||
{
|
||||
this->abort = true;
|
||||
}
|
||||
|
||||
uint8_t TestMode::getRemainingManeuverTime() const {
|
||||
if (this->busy)
|
||||
return (uint8_t) ((this->maneuverTime - (millis() - this->actionStart)) / 1000);
|
||||
uint8_t TestMode::getRemainingManeuverTime() const
|
||||
{
|
||||
if (this->busy){
|
||||
return static_cast<uint8_t>((this->maneuverTime - (millis() - this->actionStart)) / 1000);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool TestMode::engineInit(int16_t powerPercentage, int16_t seconds) {
|
||||
if (this->busy)
|
||||
bool TestMode::engineInit(int16_t powerPercentage, int16_t seconds)
|
||||
{
|
||||
if (this->busy){
|
||||
return false;
|
||||
if (powerPercentage > 100 || powerPercentage < -100)
|
||||
}
|
||||
if (powerPercentage > TestMode::maxPercentage || powerPercentage < -TestMode::maxPercentage){
|
||||
return false;
|
||||
if (seconds < 0)
|
||||
}
|
||||
if (seconds < 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
this->actionStart = millis();
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Raw);
|
||||
|
||||
@@ -16,19 +16,20 @@
|
||||
#include "moveControl.h"
|
||||
#include "driveModi/driveModi.h"
|
||||
|
||||
|
||||
/**
|
||||
* @brief Test different functions from the rover.
|
||||
*
|
||||
* You can test engine, engine controller, light and speed meter.
|
||||
*/
|
||||
class TestMode : public DriveModi {
|
||||
class TestMode : public DriveModi
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Different states to test the engine
|
||||
*
|
||||
*/
|
||||
enum Maneuver {
|
||||
enum Maneuver
|
||||
{
|
||||
None,
|
||||
LeftEngine,
|
||||
RightEngine,
|
||||
@@ -37,7 +38,7 @@ class TestMode : public DriveModi {
|
||||
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.
|
||||
@@ -107,6 +108,8 @@ class TestMode : public DriveModi {
|
||||
int16_t degree;
|
||||
uint32_t maneuverTime = 0;
|
||||
uint32_t actionStart = 0;
|
||||
|
||||
static constexpr int8_t maxPercentage = 100;
|
||||
};
|
||||
|
||||
#endif // TEST_MODE_H
|
||||
|
||||
@@ -11,22 +11,22 @@
|
||||
|
||||
#include "driveModi/driveManager.h"
|
||||
|
||||
DriveManager::DriveManager(MoveControl *moveControl, const SensorData* sensorData, const ControlPadInput *input) {
|
||||
this->driveModiParams.input = input;
|
||||
this->driveModiParams.moveControl = moveControl;
|
||||
this->driveModiParams.sensorData = sensorData;
|
||||
|
||||
DriveManager::DriveManager(MoveControl *moveControl, const SensorData *sensorData, const ControlPadInput *input)
|
||||
: driveModiParams{moveControl, input, sensorData}
|
||||
{
|
||||
this->init();
|
||||
}
|
||||
|
||||
DriveManager::DriveManager(DriveModiParams params){
|
||||
this->driveModiParams = params;
|
||||
|
||||
DriveManager::DriveManager(DriveModiParams params)
|
||||
: driveModiParams{params}
|
||||
{
|
||||
this->init();
|
||||
}
|
||||
|
||||
void DriveManager::changeModus(DriveModi* modus) {
|
||||
if (this->currentModusPtr) {
|
||||
void DriveManager::changeModus(DriveModi *modus)
|
||||
{
|
||||
if (static_cast<bool>(this->currentModusPtr))
|
||||
{
|
||||
this->removeChildComponent(this->currentModusPtr);
|
||||
delete this->currentModusPtr;
|
||||
this->currentModusPtr = nullptr;
|
||||
@@ -34,14 +34,16 @@ void DriveManager::changeModus(DriveModi* modus) {
|
||||
|
||||
this->currentModusPtr = modus;
|
||||
|
||||
if (this->currentModusPtr) {
|
||||
if (static_cast<bool>(this->currentModusPtr))
|
||||
{
|
||||
this->currentModusPtr->activate(this->driveModiParams);
|
||||
this->currentModusPtr->setSpeeds(this->drivingSpeeds);
|
||||
this->addChildComponent(this->currentModusPtr);
|
||||
}
|
||||
}
|
||||
|
||||
void DriveManager::init() {
|
||||
void DriveManager::init()
|
||||
{
|
||||
this->addChildComponent(this->driveModiParams.moveControl);
|
||||
this->activateOnlyChilds();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
#include "driveModi.h"
|
||||
|
||||
DriveModi::DriveModi() {
|
||||
this->loopDelay = 0;
|
||||
}
|
||||
|
||||
DriveModi::~DriveModi() {
|
||||
this->moveControl->setSpeed(0);
|
||||
this->moveControl->setRotationSpeed(0);
|
||||
@@ -26,6 +22,6 @@ void DriveModi::activate(DriveModiParams params){
|
||||
|
||||
void DriveModi::init() {
|
||||
this->moveControl->setDrivingStatus(MoveControl::Status::Drive);
|
||||
this->loopDelay = 40;
|
||||
this->loopDelay = DriveModi::defaultDelay;
|
||||
this->afterActivate();
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ struct DriveModiParams {
|
||||
*/
|
||||
class DriveModi : public Component {
|
||||
public:
|
||||
DriveModi();
|
||||
virtual ~DriveModi();
|
||||
|
||||
const SensorData* getSensorData() const { return this->sensorData; }
|
||||
@@ -46,12 +45,14 @@ class DriveModi : public Component {
|
||||
protected:
|
||||
virtual void afterActivate() {}
|
||||
|
||||
MoveControl *moveControl;
|
||||
MoveControl *moveControl = nullptr;
|
||||
DrivingSpeeds maxSpeeds = {1, 7};
|
||||
const ControlPadInput* input;
|
||||
const SensorData* sensorData;
|
||||
const ControlPadInput* input = nullptr;
|
||||
const SensorData* sensorData = nullptr;
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
||||
static constexpr uint8_t defaultDelay = 40;
|
||||
};
|
||||
#endif // DRIVEMODI_H
|
||||
|
||||
+139
-81
@@ -62,49 +62,59 @@ SPIClass* spiPort;
|
||||
SensorData *sensorData;
|
||||
ControlPad *controlPad;
|
||||
|
||||
bool wifiIsActive;
|
||||
constexpr uint16_t displayUpdateDelay = 500;
|
||||
|
||||
void i2cScanner(void);
|
||||
void makeMenu(void);
|
||||
void restart(void);
|
||||
void i2cScanner();
|
||||
void makeMenu();
|
||||
void restart();
|
||||
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 lcdWrapperCallback(const char data[][LcdWrapper::totalRows], uint8_t lines, uint8_t rows);
|
||||
NetworkAdresses setIPs(void);
|
||||
NetworkAdresses setIPs();
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(Settings::baudRate);
|
||||
// DebugTimes::setConsolOutput(true);
|
||||
DebugTimes setupTime;
|
||||
|
||||
spiPort = new SPIClass(HSPI);
|
||||
spiPort->begin(PinNumbers::spiSck, PinNumbers::spiCipo, PinNumbers::spiCopi, PinNumbers::gnssSpiCs);
|
||||
|
||||
mainBattery = new Battery(35);
|
||||
mainBattery = new Battery(PinNumbers::battery);
|
||||
controlPad = new ControlPad();
|
||||
|
||||
Wire.begin(21, 19);
|
||||
Wire.setClock(400000);
|
||||
Wire.begin(PinNumbers::sda, PinNumbers::scl);
|
||||
Wire.setClock(Settings::i2cSpeed);
|
||||
i2cScanner();
|
||||
lcd = new LiquidCrystal_I2C(0x3F, 16, 2);
|
||||
lcd->init();
|
||||
lcd->clear();
|
||||
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);
|
||||
if (NetworkConfig::mqtt) {
|
||||
if (network->activateMqtt(MqttConfig::user, MqttConfig::password)) {
|
||||
if (NetworkConfig::mqtt)
|
||||
{
|
||||
if (network->activateMqtt(static_cast<const char*>(MqttConfig::user),
|
||||
static_cast<const char*>(MqttConfig::password)))
|
||||
{
|
||||
DebugMqtt::init(network->getMqttClient(), Loglevel::debug);
|
||||
debugMqtt = new DebugMqtt("Console");
|
||||
outputBuf = new OutputBuf(debugMqtt);
|
||||
outputBuf->activateMqtt(true);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
outputBuf = new OutputBuf();
|
||||
}
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
outputBuf = new OutputBuf();
|
||||
}
|
||||
std::cout.rdbuf(outputBuf);
|
||||
|
||||
std::cout << "Welcome to Kleiax-Rover" << std::endl;
|
||||
@@ -115,13 +125,19 @@ void setup() {
|
||||
sensorData = new SensorData();
|
||||
sensorData->enableGnss(spiPort, PinNumbers::gnssSpiCs);
|
||||
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();
|
||||
driveManager = new DriveManager(&moveController, sensorData, controlPad->getControlPadDataPtr());
|
||||
|
||||
char wifiIndicator = 'X';
|
||||
if (network->isWifiConnected())
|
||||
{
|
||||
wifiIndicator = '-';
|
||||
}
|
||||
lcd->backlight();
|
||||
lcd->printf("%c Kleiax-Rover %c", wifiIndicator, wifiIndicator);
|
||||
lcd->setCursor(0, 1);
|
||||
@@ -134,7 +150,8 @@ void setup() {
|
||||
setupTime.stopConsol("Setup");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
void loop()
|
||||
{
|
||||
network->loop();
|
||||
sensorData->loop();
|
||||
driveManager->loop();
|
||||
@@ -144,85 +161,112 @@ void loop() {
|
||||
mainBattery->loop();
|
||||
|
||||
// new Value ervery 0.5s
|
||||
if (mainBattery->isNewValue()) {
|
||||
if (mainBattery->isNewValue())
|
||||
{
|
||||
static uint8_t batteryLowCounter = 0;
|
||||
if (mainBattery->isBatteryLow(10))
|
||||
static constexpr uint8_t minVoltage = 10;
|
||||
if (mainBattery->isBatteryLow(minVoltage))
|
||||
{
|
||||
batteryLowCounter++;
|
||||
}
|
||||
else
|
||||
{
|
||||
batteryLowCounter = 0;
|
||||
}
|
||||
|
||||
if (batteryLowCounter >= 10) {
|
||||
if (batteryLowCounter >= 10)
|
||||
{
|
||||
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->printf("Low Battery: %u", voltage);
|
||||
lcd->setCursor(0, 1);
|
||||
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;
|
||||
|
||||
byte error, address;
|
||||
int nDevices;
|
||||
byte error = 0;
|
||||
byte address = 0;
|
||||
int nDevices = 0;
|
||||
std::cout << "Scanning..." << std::endl;
|
||||
nDevices = 0;
|
||||
for(address = 1; address < 127; address++ ) {
|
||||
for (address = 1; address < maxAdresses; address++)
|
||||
{
|
||||
Wire.beginTransmission(address);
|
||||
error = Wire.endTransmission();
|
||||
if (error == 0) {
|
||||
if (error == 0)
|
||||
{
|
||||
std::cout << "I2C device found at address 0x";
|
||||
if (address<16)
|
||||
if (address < checkForLength)
|
||||
{
|
||||
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;
|
||||
nDevices++;
|
||||
}
|
||||
else if (error==4) {
|
||||
else if (error == 4)
|
||||
{
|
||||
std::cout << "Unknow error at address 0x";
|
||||
if (address<16)
|
||||
if (address < checkForLength)
|
||||
{
|
||||
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)
|
||||
std::cout << "No I2C devices found\n" << std::endl;
|
||||
{
|
||||
std::cout << "No I2C devices found\n"
|
||||
<< std::endl;
|
||||
}
|
||||
else
|
||||
std::cout << "done\n" << std::endl;
|
||||
{
|
||||
std::cout << "done\n"
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void makeMenu() {
|
||||
auto dummy = []() {
|
||||
void makeMenu()
|
||||
{
|
||||
auto dummy = []()
|
||||
{
|
||||
std::cout << "Dummy in Action" << std::endl;
|
||||
};
|
||||
|
||||
// Create Menu
|
||||
main_m = new Menu();
|
||||
main_m->setLcd(lcdWrapper);
|
||||
auto mode_m = new Menu();
|
||||
auto set_m = new Menu();
|
||||
auto pid_m = new Menu();
|
||||
auto pidl_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(0)));
|
||||
auto pidr_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(1)));
|
||||
auto speed_m = new MenuIntInput(2, new MenuSpeed(driveManager->getDrivingSpeedsRef()));
|
||||
auto man_m = new MenuManualControl(driveManager);
|
||||
auto cap_m = new MenuCaptureRoute(driveManager);
|
||||
auto auto_m = new MenuAutopilot(driveManager);
|
||||
auto testM_m = new MenuTestMode(driveManager);
|
||||
auto comp_m = new MenuCalibrateCompass(driveManager);
|
||||
auto sys_m = new MenuSysteminformation(mainBattery);
|
||||
auto sen_m = new MenuSensorData(sensorData);
|
||||
auto *mode_m = new Menu();
|
||||
auto *set_m = new Menu();
|
||||
auto *pid_m = new Menu();
|
||||
auto *pidl_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(0)));
|
||||
auto *pidr_m = new MenuIntInput(3, new MenuPidSettings(moveController.getPID(1)));
|
||||
auto *speed_m = new MenuIntInput(2, new MenuSpeed(driveManager->getDrivingSpeedsRef()));
|
||||
auto *man_m = new MenuManualControl(driveManager);
|
||||
auto *cap_m = new MenuCaptureRoute(driveManager);
|
||||
auto *auto_m = new MenuAutopilot(driveManager);
|
||||
auto *testM_m = new MenuTestMode(driveManager);
|
||||
auto *comp_m = new MenuCalibrateCompass(driveManager);
|
||||
auto *sys_m = new MenuSysteminformation(mainBattery);
|
||||
auto *sen_m = new MenuSensorData(sensorData);
|
||||
// TODO: Wie bekommt jeder die dumme Route?
|
||||
auto rout_m = new MenuRoute(new Route());
|
||||
auto bat_m = new MenuCalibrateBattery(mainBattery);
|
||||
auto *rout_m = new MenuRoute(new Route());
|
||||
auto *bat_m = new MenuCalibrateBattery(mainBattery);
|
||||
|
||||
auto_m->setUpdateDelay(1000);
|
||||
sys_m->setUpdateDelay(1500);
|
||||
sen_m->setUpdateDelay(500);
|
||||
auto_m->setUpdateDelay(displayUpdateDelay);
|
||||
sys_m->setUpdateDelay(displayUpdateDelay);
|
||||
sen_m->setUpdateDelay(displayUpdateDelay);
|
||||
|
||||
// Entry for the main menu
|
||||
main_m->addEntry(new MenuAction("Mode", mode_m));
|
||||
@@ -253,14 +297,14 @@ void makeMenu() {
|
||||
|
||||
// Other config
|
||||
pidl_m->setMinMax(0, UINT8_MAX);
|
||||
pidl_m->setEntry(0, "P-Part", (uint8_t) moveController.getPID(0)->GetKp());
|
||||
pidl_m->setEntry(1, "I-Part", (uint8_t) moveController.getPID(0)->GetKi());
|
||||
pidl_m->setEntry(2, "D-Part", (uint8_t) moveController.getPID(0)->GetKd());
|
||||
pidl_m->setEntry(0, "P-Part", static_cast<uint8_t>(moveController.getPID(0)->GetKp()));
|
||||
pidl_m->setEntry(1, "I-Part", static_cast<uint8_t>(moveController.getPID(0)->GetKi()));
|
||||
pidl_m->setEntry(2, "D-Part", static_cast<uint8_t>(moveController.getPID(0)->GetKd()));
|
||||
|
||||
pidr_m->setMinMax(0, UINT8_MAX);
|
||||
pidr_m->setEntry(0, "P-Part", (uint8_t) moveController.getPID(1)->GetKp());
|
||||
pidr_m->setEntry(1, "I-Part", (uint8_t) moveController.getPID(1)->GetKi());
|
||||
pidr_m->setEntry(2, "D-Part", (uint8_t) moveController.getPID(1)->GetKd());
|
||||
pidr_m->setEntry(0, "P-Part", static_cast<uint8_t>(moveController.getPID(1)->GetKp()));
|
||||
pidr_m->setEntry(1, "I-Part", static_cast<uint8_t>(moveController.getPID(1)->GetKi()));
|
||||
pidr_m->setEntry(2, "D-Part", static_cast<uint8_t>(moveController.getPID(1)->GetKd()));
|
||||
|
||||
speed_m->setMinMax(5, UINT8_MAX);
|
||||
speed_m->setEntry(0, "x m/s e-1", driveManager->getDrivingSpeedsRef().x * 10);
|
||||
@@ -271,42 +315,56 @@ void makeMenu() {
|
||||
controlPad->setMenuControl(main_m);
|
||||
}
|
||||
|
||||
void restart() {
|
||||
void restart()
|
||||
{
|
||||
lcdWrapper->clear();
|
||||
lcdWrapper->setCursor(0, 0);
|
||||
lcdWrapper->print("Rebooting ...");
|
||||
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))
|
||||
{
|
||||
return;
|
||||
}
|
||||
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)
|
||||
{
|
||||
std::cout << "sendCallback - Delivery Fail" << std::endl;
|
||||
}
|
||||
|
||||
void lcdWrapperCallback (const char data[][LcdWrapper::totalRows], uint8_t lines, uint8_t rows) {
|
||||
if (!controlPad->isControlPadConnected())
|
||||
return;
|
||||
|
||||
esp_err_t result = esp_now_send(network->getBroadcastAddress(), (uint8_t *) data, lines * rows);
|
||||
|
||||
if (result != ESP_OK)
|
||||
Serial.println("Error sending the data");
|
||||
}
|
||||
|
||||
NetworkAdresses setIPs() {
|
||||
void lcdWrapperCallback(const char data[][LcdWrapper::totalRows], uint8_t lines, uint8_t rows)
|
||||
{
|
||||
if (!controlPad->isControlPadConnected())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const esp_err_t result = esp_now_send(network->getBroadcastAddress(), reinterpret_cast<const uint8_t *>(data), lines * rows);
|
||||
|
||||
if (result != ESP_OK)
|
||||
{
|
||||
Serial.println("Error sending the data");
|
||||
}
|
||||
}
|
||||
|
||||
NetworkAdresses setIPs()
|
||||
{
|
||||
NetworkAdresses adresses;
|
||||
adresses.localIP.fromString(NetworkConfig::ip);
|
||||
adresses.subnet.fromString(NetworkConfig::subnet);
|
||||
adresses.gateway.fromString(NetworkConfig::gateway);
|
||||
adresses.dnsServer.fromString(NetworkConfig::dns);
|
||||
if (NetworkConfig::mqtt) {
|
||||
adresses.mqttServer.fromString(MqttConfig::server);
|
||||
adresses.localIP.fromString(static_cast<const char *>(NetworkConfig::ip));
|
||||
adresses.subnet.fromString(static_cast<const char *>(NetworkConfig::subnet));
|
||||
adresses.gateway.fromString(static_cast<const char *>(NetworkConfig::gateway));
|
||||
adresses.dnsServer.fromString(static_cast<const char *>(NetworkConfig::dns));
|
||||
if (NetworkConfig::mqtt)
|
||||
{
|
||||
adresses.mqttServer.fromString(static_cast<const char *>(MqttConfig::server));
|
||||
adresses.mqttPort = MqttConfig::port;
|
||||
}
|
||||
|
||||
|
||||
+78
-44
@@ -10,28 +10,27 @@
|
||||
*/
|
||||
#include "moveControl.h"
|
||||
|
||||
MoveControl::MoveControl() {
|
||||
this->loopDelay = 20;
|
||||
this->left_motor = new MotorControl();
|
||||
this->right_motor = new MotorControl();
|
||||
this->left_speedometer = new Speedometer(PinNumbers::LeftMotor::encoder, Settings::wheelDiameter, Settings::encoderSteps);
|
||||
this->right_speedometer = new Speedometer(PinNumbers::RightMotor::encoder, Settings::wheelDiameter, Settings::encoderSteps);
|
||||
|
||||
this->left_pid = new PID( &this->wheelspeed_left,
|
||||
MoveControl::MoveControl()
|
||||
: Component(MoveControl::loopDelay),
|
||||
left_motor{new MotorControl()},
|
||||
right_motor{new MotorControl()},
|
||||
left_speedometer{new Speedometer(PinNumbers::LeftMotor::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_out,
|
||||
&this->wheelspeed_left_target,
|
||||
Settings::Pid::Left::P,
|
||||
Settings::Pid::Left::I,
|
||||
Settings::Pid::Left::D,
|
||||
DIRECT);
|
||||
this->right_pid = new PID( &this->wheelspeed_right,
|
||||
DIRECT)},
|
||||
right_pid{new PID(&this->wheelspeed_right,
|
||||
&this->right_pid_out,
|
||||
&this->wheelspeed_right_target,
|
||||
Settings::Pid::Right::P,
|
||||
Settings::Pid::Right::I,
|
||||
Settings::Pid::Right::D,
|
||||
DIRECT);
|
||||
|
||||
DIRECT)}
|
||||
{
|
||||
this->left_pid->SetOutputLimits(Settings::Pid::outMin, Settings::Pid::outMax);
|
||||
this->left_pid->SetSampleTime(Settings::Pid::sampleTime);
|
||||
this->left_pid->SetMode(AUTOMATIC);
|
||||
@@ -49,7 +48,8 @@ MoveControl::MoveControl() {
|
||||
this->addChildComponent(this->right_speedometer);
|
||||
}
|
||||
|
||||
MoveControl::~MoveControl() {
|
||||
MoveControl::~MoveControl()
|
||||
{
|
||||
this->left_motor->emergencyStop();
|
||||
this->right_motor->emergencyStop();
|
||||
|
||||
@@ -59,10 +59,10 @@ MoveControl::~MoveControl() {
|
||||
delete this->right_speedometer;
|
||||
delete this->left_pid;
|
||||
delete this->right_pid;
|
||||
|
||||
}
|
||||
|
||||
void MoveControl::run() {
|
||||
void MoveControl::run()
|
||||
{
|
||||
this->updateCurrentWheelSpeed();
|
||||
this->calcTargetWheelSpeed();
|
||||
|
||||
@@ -72,7 +72,8 @@ void MoveControl::run() {
|
||||
this->regulateMotors();
|
||||
}
|
||||
|
||||
void MoveControl::setDrivingStatus(Status status) {
|
||||
void MoveControl::setDrivingStatus(Status status)
|
||||
{
|
||||
this->setSpeed(0);
|
||||
this->setRotationSpeed(0);
|
||||
this->setRawPowerLeft(0);
|
||||
@@ -97,7 +98,8 @@ void MoveControl::setDrivingStatus(Status status) {
|
||||
// }
|
||||
}
|
||||
|
||||
void MoveControl::emergencyStop() {
|
||||
void MoveControl::emergencyStop()
|
||||
{
|
||||
this->left_motor->emergencyStop();
|
||||
this->right_motor->emergencyStop();
|
||||
this->setSpeed(0);
|
||||
@@ -107,8 +109,10 @@ void MoveControl::emergencyStop() {
|
||||
this->driving_status = Status::Stop;
|
||||
}
|
||||
|
||||
void MoveControl::setSpeed(double speed) {
|
||||
if (speed < 0.2 && speed > -0.2) {
|
||||
void MoveControl::setSpeed(double speed)
|
||||
{
|
||||
if (speed < MoveControl::minSpeed && speed > -MoveControl::minSpeed)
|
||||
{
|
||||
this->drivingSpeeds.x = 0;
|
||||
return;
|
||||
}
|
||||
@@ -116,8 +120,10 @@ void MoveControl::setSpeed(double speed) {
|
||||
this->drivingSpeeds.x = speed;
|
||||
}
|
||||
|
||||
void MoveControl::setRotationSpeed(double speed) {
|
||||
if (speed < 0.1 && speed > -0.1){
|
||||
void MoveControl::setRotationSpeed(double speed)
|
||||
{
|
||||
if (speed < MoveControl::minSpeed && speed > -MoveControl::minSpeed)
|
||||
{
|
||||
this->drivingSpeeds.rot = 0;
|
||||
return;
|
||||
}
|
||||
@@ -125,64 +131,91 @@ void MoveControl::setRotationSpeed(double speed) {
|
||||
this->drivingSpeeds.rot = speed;
|
||||
}
|
||||
|
||||
void MoveControl::setSpeeds(DrivingSpeeds drivingSpeeds) {
|
||||
void MoveControl::setSpeeds(DrivingSpeeds drivingSpeeds)
|
||||
{
|
||||
this->setSpeed(drivingSpeeds.x);
|
||||
this->setRotationSpeed(drivingSpeeds.rot);
|
||||
}
|
||||
|
||||
void MoveControl::setRawPowerLeft(int16_t power) {
|
||||
if (power <= 100 && power >= -100)
|
||||
this->rawPowerLeft = power;
|
||||
void MoveControl::setRawPowerLeft(int16_t power)
|
||||
{
|
||||
if (power <= MoveControl::maxPercentage && power >= -MoveControl::maxPercentage)
|
||||
{
|
||||
this->rawPowerLeft = static_cast<int8_t>(power);
|
||||
}
|
||||
}
|
||||
|
||||
void MoveControl::setRawPowerRight(int16_t power) {
|
||||
if (power <= 100 && power >= -100)
|
||||
this->rawPowerRight = power;
|
||||
void MoveControl::setRawPowerRight(int16_t 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;
|
||||
if (side == 0)
|
||||
{
|
||||
selectedPID = this->left_pid;
|
||||
}
|
||||
else if (side == 1)
|
||||
{
|
||||
selectedPID = this->right_pid;
|
||||
|
||||
selectedPID->SetTunings(p, i, d);
|
||||
}
|
||||
|
||||
PID* MoveControl::getPID(uint8_t side) const {
|
||||
selectedPID->SetTunings(pPart, iPart, dPart);
|
||||
}
|
||||
|
||||
PID *MoveControl::getPID(uint8_t side) const
|
||||
{
|
||||
if (side == 0)
|
||||
{
|
||||
return this->left_pid;
|
||||
else if (side == 1)
|
||||
}
|
||||
if (side == 1)
|
||||
{
|
||||
return this->right_pid;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void MoveControl::setSpeedometerDirection(Speedometer *speedometer, double value) {
|
||||
void MoveControl::setSpeedometerDirection(Speedometer *speedometer, double value)
|
||||
{
|
||||
if (value > 0)
|
||||
{
|
||||
speedometer->setDirection(Speedometer::Direction::Forward);
|
||||
}
|
||||
else if (value < 0)
|
||||
{
|
||||
speedometer->setDirection(Speedometer::Direction::Backward);
|
||||
}
|
||||
else
|
||||
{
|
||||
speedometer->setDirection(Speedometer::Direction::None);
|
||||
}
|
||||
}
|
||||
|
||||
void MoveControl::calcTargetWheelSpeed() {
|
||||
void MoveControl::calcTargetWheelSpeed()
|
||||
{
|
||||
/* original formula:
|
||||
(1 / r) / 1 b \ / x \ = / Xl \
|
||||
\ 1 -b / \ T / \ Xr / */
|
||||
|
||||
// (1 / r) * 1
|
||||
constexpr double A = 1.0 / (Settings::wheelDiameter / 2);
|
||||
constexpr double A1r1 = 1.0 / (Settings::wheelDiameter / 2);
|
||||
// (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_left_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 = (A1r1 * this->drivingSpeeds.x + (-B1rb) * this->drivingSpeeds.rot);
|
||||
}
|
||||
|
||||
void MoveControl::regulateMotors() {
|
||||
switch (this->driving_status) {
|
||||
void MoveControl::regulateMotors()
|
||||
{
|
||||
switch (this->driving_status)
|
||||
{
|
||||
case Status::Stop:
|
||||
this->left_motor->setTargetPower(0);
|
||||
this->right_motor->setTargetPower(0);
|
||||
@@ -191,8 +224,8 @@ void MoveControl::regulateMotors() {
|
||||
break;
|
||||
|
||||
case Status::Drive:
|
||||
this->left_motor->setTargetPower( (int8_t) this->left_pid_out);
|
||||
this->right_motor->setTargetPower( (int8_t) this->right_pid_out);
|
||||
this->left_motor->setTargetPower(static_cast<int8_t>(this->left_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->right_speedometer, this->right_motor->getPower());
|
||||
break;
|
||||
@@ -210,7 +243,8 @@ void MoveControl::regulateMotors() {
|
||||
}
|
||||
}
|
||||
|
||||
void MoveControl::updateCurrentWheelSpeed() {
|
||||
void MoveControl::updateCurrentWheelSpeed()
|
||||
{
|
||||
this->wheelspeed_left = this->left_speedometer->getSpeedRad();
|
||||
this->wheelspeed_right = this->right_speedometer->getSpeedRad();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user