diff --git a/.github/zip_content.txt b/.github/zip_content.txt index 04b3afc0..9488994e 100644 --- a/.github/zip_content.txt +++ b/.github/zip_content.txt @@ -10,4 +10,4 @@ flash.py monitor.py README.md requirements.txt -LICENSE \ No newline at end of file +LICENSE diff --git a/.gitignore b/.gitignore index 7dfcb42a..2aa95566 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ sdkconfig owl_executable config.txt *.lock -.venv \ No newline at end of file +.venv diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..74384c8e --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,12 @@ +default_install_hook_types: + - pre-commit + - pre-push + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-merge-conflict + - id: double-quote-string-fixer diff --git a/.syncignore b/.syncignore index 74fb5d05..a1d3ec32 100644 --- a/.syncignore +++ b/.syncignore @@ -3,4 +3,4 @@ __pycache__/ .DS_Store *.tmp .env -.venv \ No newline at end of file +.venv diff --git a/backtrace.sh b/backtrace.sh index 4f1492db..203fe0fe 100755 --- a/backtrace.sh +++ b/backtrace.sh @@ -7,6 +7,6 @@ then exit fi -addr2line=~/esp/esp-tools_4.2/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-addr2line +addr2line=~/esp/esp-tools_4.2/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-addr2line addresses=$@ $addr2line -e build/lizard.elf $addresses diff --git a/examples/ota_example/main.py b/examples/ota_example/main.py index b31071a0..a1b9ab68 100755 --- a/examples/ota_example/main.py +++ b/examples/ota_example/main.py @@ -26,10 +26,10 @@ def ota_binary_verify(request: Request) -> Response: verify_bin_str = os.path.basename(verify_bin).replace('.bin', '').replace('lizard', '').replace('-', '') if verify_bin_str is None: log.push('No "Lizard" binary found. But connection established') - return Response("No Lizard") - if verify_bin_str == "": + return Response('No Lizard') + if verify_bin_str == '': log.push('Binary without version found') - return Response("Unknown version") + return Response('Unknown version') response = Response(verify_bin_str) log.push(f'Send response: {verify_bin_str}') return response diff --git a/examples/ros/docker.sh b/examples/ros/docker.sh index 0eaceeef..5c93ae8f 100755 --- a/examples/ros/docker.sh +++ b/examples/ros/docker.sh @@ -26,7 +26,7 @@ do docker build --tag $name . || exit ;; r | run) docker run -it $args $name || exit ;; - s | shell) + s | shell) docker run -it $args $name /bin/bash || exit ;; l | log | logs) docker logs -f --tail 100 $name || exit ;; diff --git a/main/.gitignore b/main/.gitignore index da2eeb3e..98a97ff8 100644 --- a/main/.gitignore +++ b/main/.gitignore @@ -1 +1 @@ -parser.h \ No newline at end of file +parser.h diff --git a/main/compilation/action.h b/main/compilation/action.h index 962756ca..47f2a59f 100644 --- a/main/compilation/action.h +++ b/main/compilation/action.h @@ -8,4 +8,4 @@ using Action_ptr = std::shared_ptr; class Action { public: virtual bool run() = 0; -}; \ No newline at end of file +}; diff --git a/main/compilation/await_condition.cpp b/main/compilation/await_condition.cpp index 3b1d4ffa..3ebb1341 100644 --- a/main/compilation/await_condition.cpp +++ b/main/compilation/await_condition.cpp @@ -6,4 +6,4 @@ AwaitCondition::AwaitCondition(const ConstExpression_ptr condition) bool AwaitCondition::run() { return this->condition->evaluate_boolean(); -} \ No newline at end of file +} diff --git a/main/compilation/await_condition.h b/main/compilation/await_condition.h index 35131ae5..23aae0c6 100644 --- a/main/compilation/await_condition.h +++ b/main/compilation/await_condition.h @@ -9,4 +9,4 @@ class AwaitCondition : public Action { AwaitCondition(const ConstExpression_ptr condition); bool run() override; -}; \ No newline at end of file +}; diff --git a/main/compilation/await_routine.cpp b/main/compilation/await_routine.cpp index ae056193..fc2fe2a5 100644 --- a/main/compilation/await_routine.cpp +++ b/main/compilation/await_routine.cpp @@ -14,4 +14,4 @@ bool AwaitRoutine::run() { this->is_waiting = false; } return can_proceed; -} \ No newline at end of file +} diff --git a/main/compilation/await_routine.h b/main/compilation/await_routine.h index 1425cfc6..31accc06 100644 --- a/main/compilation/await_routine.h +++ b/main/compilation/await_routine.h @@ -12,4 +12,4 @@ class AwaitRoutine : public Action { AwaitRoutine(const Routine_ptr routine); bool run() override; -}; \ No newline at end of file +}; diff --git a/main/compilation/method_call.cpp b/main/compilation/method_call.cpp index 272bc98f..428e2cd9 100644 --- a/main/compilation/method_call.cpp +++ b/main/compilation/method_call.cpp @@ -7,4 +7,4 @@ MethodCall::MethodCall(const Module_ptr module, const std::string method_name, c bool MethodCall::run() { this->module->call_with_shadows(this->method_name, this->arguments); return true; -} \ No newline at end of file +} diff --git a/main/compilation/method_call.h b/main/compilation/method_call.h index f8090a85..d5e01a42 100644 --- a/main/compilation/method_call.h +++ b/main/compilation/method_call.h @@ -14,4 +14,4 @@ class MethodCall : public Action { MethodCall(const Module_ptr module, const std::string method_name, const std::vector arguments); bool run() override; -}; \ No newline at end of file +}; diff --git a/main/compilation/property_assignment.cpp b/main/compilation/property_assignment.cpp index dca5d790..96dbf9b1 100644 --- a/main/compilation/property_assignment.cpp +++ b/main/compilation/property_assignment.cpp @@ -7,4 +7,4 @@ PropertyAssignment::PropertyAssignment(const Module_ptr module, const std::strin bool PropertyAssignment::run() { this->module->write_property(this->property_name, this->expression); return true; -} \ No newline at end of file +} diff --git a/main/compilation/property_assignment.h b/main/compilation/property_assignment.h index 0b3123ec..9cab7981 100644 --- a/main/compilation/property_assignment.h +++ b/main/compilation/property_assignment.h @@ -12,4 +12,4 @@ class PropertyAssignment : public Action { PropertyAssignment(const Module_ptr module, const std::string property_name, const ConstExpression_ptr expression); bool run() override; -}; \ No newline at end of file +}; diff --git a/main/compilation/routine.h b/main/compilation/routine.h index 687498c8..5923a8d0 100644 --- a/main/compilation/routine.h +++ b/main/compilation/routine.h @@ -17,4 +17,4 @@ class Routine { bool is_running() const; void start(); void step(); -}; \ No newline at end of file +}; diff --git a/main/compilation/routine_call.cpp b/main/compilation/routine_call.cpp index a71d7957..3a00544f 100644 --- a/main/compilation/routine_call.cpp +++ b/main/compilation/routine_call.cpp @@ -6,4 +6,4 @@ RoutineCall::RoutineCall(const Routine_ptr routine) : routine(routine) { bool RoutineCall::run() { this->routine->start(); return true; -} \ No newline at end of file +} diff --git a/main/compilation/routine_call.h b/main/compilation/routine_call.h index ac220baf..ee5b4298 100644 --- a/main/compilation/routine_call.h +++ b/main/compilation/routine_call.h @@ -9,4 +9,4 @@ class RoutineCall : public Action { RoutineCall(const Routine_ptr routine); bool run() override; -}; \ No newline at end of file +}; diff --git a/main/compilation/rule.h b/main/compilation/rule.h index e0f14696..6cb21645 100644 --- a/main/compilation/rule.h +++ b/main/compilation/rule.h @@ -13,4 +13,4 @@ class Rule { const ConstExpression_ptr condition; const Routine_ptr routine; Rule(const ConstExpression_ptr condition, const Routine_ptr routine); -}; \ No newline at end of file +}; diff --git a/main/compilation/variable_assignment.cpp b/main/compilation/variable_assignment.cpp index 01c94263..c8eee597 100644 --- a/main/compilation/variable_assignment.cpp +++ b/main/compilation/variable_assignment.cpp @@ -7,4 +7,4 @@ VariableAssignment::VariableAssignment(const Variable_ptr variable, const ConstE bool VariableAssignment::run() { this->variable->assign(this->expression); return true; -} \ No newline at end of file +} diff --git a/main/compilation/variable_assignment.h b/main/compilation/variable_assignment.h index 27c1c79c..e6a33579 100644 --- a/main/compilation/variable_assignment.h +++ b/main/compilation/variable_assignment.h @@ -11,4 +11,4 @@ class VariableAssignment : public Action { VariableAssignment(const Variable_ptr variable, const ConstExpression_ptr expression); bool run() override; -}; \ No newline at end of file +}; diff --git a/main/component.mk b/main/component.mk index 73c5a52d..125eedf9 100644 --- a/main/component.mk +++ b/main/component.mk @@ -5,4 +5,4 @@ CXXFLAGS += -std=c++17 -COMPONENT_SRCDIRS := . compilation modules utils \ No newline at end of file +COMPONENT_SRCDIRS := . compilation modules utils diff --git a/main/modules/BNO055ESP32.cpp b/main/modules/BNO055ESP32.cpp index 68a0177c..91c1db55 100644 --- a/main/modules/BNO055ESP32.cpp +++ b/main/modules/BNO055ESP32.cpp @@ -845,4 +845,4 @@ void BNO055::stop() { #ifndef BNO055_DEBUG_OFF ESP_LOGD(BNO055_LOG_TAG, "Destroyed"); #endif -} \ No newline at end of file +} diff --git a/main/modules/BNO055ESP32.h b/main/modules/BNO055ESP32.h index 39795a69..581f5c02 100644 --- a/main/modules/BNO055ESP32.h +++ b/main/modules/BNO055ESP32.h @@ -729,4 +729,4 @@ class BNO055 { void disableInterrupt(uint8_t flag); }; -#endif \ No newline at end of file +#endif diff --git a/main/modules/core.cpp b/main/modules/core.cpp index 858d31c2..0027f80b 100644 --- a/main/modules/core.cpp +++ b/main/modules/core.cpp @@ -199,4 +199,4 @@ std::string Core::get_output() const { void Core::keep_alive() { this->last_message_millis = millis(); -} \ No newline at end of file +} diff --git a/main/modules/core.h b/main/modules/core.h index 9a4f7f9e..5fdb86c5 100644 --- a/main/modules/core.h +++ b/main/modules/core.h @@ -26,4 +26,4 @@ class Core : public Module { void set(std::string property_name, double value); std::string get_output() const override; void keep_alive(); -}; \ No newline at end of file +}; diff --git a/main/modules/d1_motor.h b/main/modules/d1_motor.h index a5c2c59c..756f3294 100644 --- a/main/modules/d1_motor.h +++ b/main/modules/d1_motor.h @@ -32,4 +32,4 @@ class D1Motor : public Module, public std::enable_shared_from_this { void profile_position(const int32_t position); void profile_velocity(const int32_t velocity); void stop(); -}; \ No newline at end of file +}; diff --git a/main/modules/dunker_motor.cpp b/main/modules/dunker_motor.cpp index d67cea2e..993d303d 100644 --- a/main/modules/dunker_motor.cpp +++ b/main/modules/dunker_motor.cpp @@ -145,4 +145,4 @@ void DunkerMotor::speed(const double speed) { double DunkerMotor::get_speed() { return this->properties.at("speed")->number_value; -} \ No newline at end of file +} diff --git a/main/modules/input.h b/main/modules/input.h index 6a4b128f..71d1bb06 100644 --- a/main/modules/input.h +++ b/main/modules/input.h @@ -42,4 +42,4 @@ class McpInput : public Input { public: McpInput(const std::string name, const Mcp23017_ptr mcp, const uint8_t number); bool get_level() const override; -}; \ No newline at end of file +}; diff --git a/main/modules/linear_motor.h b/main/modules/linear_motor.h index cac6e866..a465f44b 100644 --- a/main/modules/linear_motor.h +++ b/main/modules/linear_motor.h @@ -58,4 +58,4 @@ class McpLinearMotor : public LinearMotor { const uint8_t move_out, const uint8_t end_in, const uint8_t end_out); -}; \ No newline at end of file +}; diff --git a/main/modules/odrive_motor.h b/main/modules/odrive_motor.h index fc004b56..64bc2217 100644 --- a/main/modules/odrive_motor.h +++ b/main/modules/odrive_motor.h @@ -38,4 +38,4 @@ class ODriveMotor : public Module, public std::enable_shared_from_this arguments); void call(const std::string method_name, const std::vector arguments) override; void write_property(const std::string property_name, const ConstExpression_ptr expression, const bool from_expander) override; -}; \ No newline at end of file +}; diff --git a/main/modules/rmd_motor.h b/main/modules/rmd_motor.h index 5992374e..241a3e1e 100644 --- a/main/modules/rmd_motor.h +++ b/main/modules/rmd_motor.h @@ -42,4 +42,4 @@ class RmdMotor : public Module, public std::enable_shared_from_this { double get_position() const; double get_speed() const; bool set_acceleration(const uint8_t index, const uint32_t acceleration); -}; \ No newline at end of file +}; diff --git a/main/modules/roboclaw.h b/main/modules/roboclaw.h index 49e44f90..032ed8ea 100644 --- a/main/modules/roboclaw.h +++ b/main/modules/roboclaw.h @@ -221,4 +221,4 @@ class RoboClaw : public Module { uint32_t Read4(uint8_t cmd, bool *valid); uint16_t Read2(uint8_t cmd, bool *valid); uint8_t Read1(uint8_t cmd, bool *valid); -}; \ No newline at end of file +}; diff --git a/main/parser.h b/main/parser.h index eed64daa..a9c21ed5 100644 --- a/main/parser.h +++ b/main/parser.h @@ -8194,4 +8194,3 @@ static void left_right_operand_slots_lookup(uint32_t rule, uint32_t *left, uint3 } } #endif - diff --git a/main/storage.h b/main/storage.h index b246e261..b1d73930 100644 --- a/main/storage.h +++ b/main/storage.h @@ -16,4 +16,4 @@ class Storage { static void print_startup(const std::string substring = ""); static void save_startup(); static void clear_nvs(); -}; \ No newline at end of file +}; diff --git a/main/utils/string_utils.cpp b/main/utils/string_utils.cpp index 4ef552b5..6c1b27fe 100644 --- a/main/utils/string_utils.cpp +++ b/main/utils/string_utils.cpp @@ -27,4 +27,4 @@ int csprintf(char *buffer, size_t buffer_len, const char *format, ...) { throw std::runtime_error("buffer too small"); return num_chars; -} \ No newline at end of file +} diff --git a/main/utils/string_utils.h b/main/utils/string_utils.h index 16e71db9..6c481fb1 100644 --- a/main/utils/string_utils.h +++ b/main/utils/string_utils.h @@ -6,4 +6,4 @@ std::string cut_first_word(std::string &msg, char delimiter = ' '); bool starts_with(const std::string haystack, const std::string needle); -int csprintf(char *buffer, size_t buffer_len, const char *format, ...); \ No newline at end of file +int csprintf(char *buffer, size_t buffer_len, const char *format, ...); diff --git a/main/utils/timing.cpp b/main/utils/timing.cpp index d88c1bba..f01cee1b 100644 --- a/main/utils/timing.cpp +++ b/main/utils/timing.cpp @@ -21,4 +21,4 @@ unsigned long millis_since(const unsigned long time) { unsigned long micros_since(const unsigned long time) { return micros() - time; -} \ No newline at end of file +} diff --git a/main/utils/timing.h b/main/utils/timing.h index 5996bc19..e7b747fe 100644 --- a/main/utils/timing.h +++ b/main/utils/timing.h @@ -8,4 +8,4 @@ unsigned long int micros(); unsigned long int millis(); unsigned long millis_since(const unsigned long time); -unsigned long micros_since(const unsigned long time); \ No newline at end of file +unsigned long micros_since(const unsigned long time);