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:
@@ -3,6 +3,7 @@ idf_component_register(
|
||||
"wifi.c"
|
||||
"buzzer.cpp"
|
||||
"uart_common.cpp"
|
||||
"types.cpp"
|
||||
INCLUDE_DIRS
|
||||
"."
|
||||
PRIV_REQUIRES nvs_flash
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user