57 lines
1.2 KiB
Markdown
57 lines
1.2 KiB
Markdown
# Zephyr Sand Table firmware
|
|
|
|
This repository contains the implementation of Sand Table firmware for the Zephyr RTOS.
|
|
|
|
The firmware controls 2x stepper motors and RGBW LED strip.
|
|
|
|
### BUILD
|
|
|
|
```
|
|
west build -p -b arduino_nano_connect
|
|
```
|
|
|
|
### ACK
|
|
|
|
Every command returns either an ACK or NACK.
|
|
|
|
Homing, Step, and Polar commands return separate ACK when the arms are done moving.
|
|
|
|
### Command Structure
|
|
|
|
```c
|
|
struct command_message_t {
|
|
uint8_t prefix; // 0x69
|
|
uint8_t length; // Length of the data
|
|
uint8_t id; // 0x00
|
|
uint8_t command;
|
|
uint8_t crc;
|
|
uint8_t data[160];
|
|
} __attribute__((packed));
|
|
```
|
|
|
|
### Commands
|
|
|
|
```c
|
|
typedef enum {
|
|
COMMAND_ACK,
|
|
COMMAND_NACK,
|
|
COMMAND_LED,
|
|
COMMAND_HOME,
|
|
COMMAND_DISABLE_MOTORS,
|
|
COMMAND_MOTOR_STEP,
|
|
COMMAND_MOTOR_SPEED,
|
|
COMMAND_POLAR,
|
|
COMMAND_GET_POLAR,
|
|
COMMAND_SET_OFFSET,
|
|
COMMAND_RESET_OFFSET,
|
|
} commands_e;
|
|
```
|
|
|
|
### Python test scripts (AI generated)
|
|
|
|
* `home.py` = sends homing command
|
|
* `led.py` = sends led command which sends led fade track
|
|
* `position.py` = sends position command and returns the current position
|
|
* `reset_offset.py` = sends reset_offset command
|
|
* `track.py {track name}` = reads a thetarho file and sends polar coordinates line by line
|