fixed bug parsing the command 'd'

This commit is contained in:
pgdalmeida 2026-05-07 20:29:42 +02:00
parent b772606b8d
commit ec57c5ba56
Signed by: pedro.almeida
GPG Key ID: D4A6C394DF13F1D7
4 changed files with 17 additions and 15 deletions

View File

@ -41,7 +41,7 @@ The system mounts a camera on a 2-axis gimbal (yaw + pitch) and continuously sca
## Quick Start
1. **Flash firmware:** `cd firmware && pio run --environment megaatmega2560 --target upload`
1. **Flash firmware:** `cd firmware && pio run -t upload`
2. **Build host:** `cd host/build && cmake .. && make -j$(nproc)`
3. **Run host:** `./FireWatchTower_2axis --init true --start true`

View File

@ -9,12 +9,6 @@
#include "TMC5160.h"
void parser(char &c) {
int base = 16;
if (Serial.peek() == 'd') {
Serial.read();
base = 10;
}
static char buffer[32];
size_t len = Serial.readBytesUntil('\n', buffer, sizeof(buffer) - 1);
buffer[len] = '\0';
@ -29,8 +23,8 @@ void parser(char &c) {
}
switch (c) {
case 'r':
case 'r': // power cycle the motors
init_motor_params();
motor_power_on(MotorPitch);
motor_power_on(MotorYaw);
@ -39,22 +33,22 @@ void parser(char &c) {
Serial.println(F("Reset"));
break;
case 'q':
case 'q': // find endstop
do_endstop(MotorYaw);
do_endstop(MotorPitch);
break;
case '!':
case '!': // turn motors off
motor_power_off(MotorPitch);
motor_power_off(MotorYaw);
break;
case '*':
case '*': // turn motors on
motor_power_on(MotorPitch);
motor_power_on(MotorYaw);
break;
case 'm':
case 'm': // move to a specific position in yawl
Serial.print(F("Move "));
Serial.print(args[0]);
Serial.print(F(" with "));
@ -62,11 +56,11 @@ void parser(char &c) {
tmc5160_moveTo(MotorYaw, args[0], args[1]);
break;
case ';':
case ';': // change position homing (0x21: XACTUAL register)
tmc5160_writeRegister(MotorYaw, 0x21, args[0]);
break;
case 's':
case 's': // stop motors
tmc5160_rotateMotor(MotorPitch, 0);
tmc5160_rotateMotor(MotorYaw, 0);
Serial.println(F("Stop"));

8
host/deploy_host.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
rsync -av --exclude='build/' ~/code/FireWatchTower_2axis/host/ ggs@10.11.12.111:/home/ggs/projects/FireWatchTower_2axis/host
ssh ggs@10.11.12.111 "
mkdir -p /home/ggs/projects/FireWatchTower_2axis/host/build &&
cd /home/ggs/projects/FireWatchTower_2axis/host/build &&
cmake .. &&
make -j\$(nproc)
"