send, receive, apply motorCommands works (proof of concept); add timeout

- board_control successfully sends motor commands to board_motorctl
- board_motorctl receives and applies motor commands
note: control pcb currently switches to HTTP mode after startup for testing
with data from ui

- partially commented in code that has to be reworked
- control: send commands via uart instead of to motor objects
- board motorctl handled motor: add timeout when no target data
  received (e.g. control pcb offline / uart bugged)
- board motorctl uart: receive motorCommands_t struct and apply data to
  target state of handled motors
- types: fix issue with global motorstateStr variable
This commit is contained in:
jonny_jr9
2023-08-30 09:01:44 +02:00
parent 59a4f8c13f
commit 1e544613ee
13 changed files with 562 additions and 500 deletions

View File

@@ -3,6 +3,7 @@ idf_component_register(
"wifi.c"
"buzzer.cpp"
"uart_common.cpp"
"types.cpp"
INCLUDE_DIRS
"."
PRIV_REQUIRES nvs_flash

View File

@@ -19,7 +19,7 @@ extern "C"
//===============================
enum class motorstate_t {IDLE, FWD, REV, BRAKE};
//definition of string array to be able to convert state enum to readable string (defined in motordrivers.cpp)
const char* motorstateStr[] = {"IDLE", "FWD", "REV", "BRAKE"};
extern const char* motorstateStr[4];

View File

@@ -15,8 +15,9 @@ extern "C"
#include "freertos/queue.h"
#include "driver/uart.h"
}
#include "types.hpp"
//struct for testin uart
//struct for testing uart
typedef struct {
uint32_t timestamp;
int id;
@@ -24,6 +25,13 @@ typedef struct {
} uartData_test_t;
//unnecessary, using commands struct directly
typedef struct {
uint32_t timestamp;
motorCommands_t commands;
} uartData_motorCommands_t;
//===== uart_init =====
//should be run once at startup
void uart_init(void);