fixed bug parsing the command 'd'
This commit is contained in:
parent
b772606b8d
commit
ec57c5ba56
|
|
@ -41,7 +41,7 @@ The system mounts a camera on a 2-axis gimbal (yaw + pitch) and continuously sca
|
||||||
|
|
||||||
## Quick Start
|
## 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)`
|
2. **Build host:** `cd host/build && cmake .. && make -j$(nproc)`
|
||||||
3. **Run host:** `./FireWatchTower_2axis --init true --start true`
|
3. **Run host:** `./FireWatchTower_2axis --init true --start true`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,6 @@
|
||||||
#include "TMC5160.h"
|
#include "TMC5160.h"
|
||||||
|
|
||||||
void parser(char &c) {
|
void parser(char &c) {
|
||||||
int base = 16;
|
|
||||||
if (Serial.peek() == 'd') {
|
|
||||||
Serial.read();
|
|
||||||
base = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char buffer[32];
|
static char buffer[32];
|
||||||
size_t len = Serial.readBytesUntil('\n', buffer, sizeof(buffer) - 1);
|
size_t len = Serial.readBytesUntil('\n', buffer, sizeof(buffer) - 1);
|
||||||
buffer[len] = '\0';
|
buffer[len] = '\0';
|
||||||
|
|
@ -30,7 +24,7 @@ void parser(char &c) {
|
||||||
|
|
||||||
switch (c) {
|
switch (c) {
|
||||||
|
|
||||||
case 'r':
|
case 'r': // power cycle the motors
|
||||||
init_motor_params();
|
init_motor_params();
|
||||||
motor_power_on(MotorPitch);
|
motor_power_on(MotorPitch);
|
||||||
motor_power_on(MotorYaw);
|
motor_power_on(MotorYaw);
|
||||||
|
|
@ -39,22 +33,22 @@ void parser(char &c) {
|
||||||
Serial.println(F("Reset"));
|
Serial.println(F("Reset"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'q':
|
case 'q': // find endstop
|
||||||
do_endstop(MotorYaw);
|
do_endstop(MotorYaw);
|
||||||
do_endstop(MotorPitch);
|
do_endstop(MotorPitch);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '!':
|
case '!': // turn motors off
|
||||||
motor_power_off(MotorPitch);
|
motor_power_off(MotorPitch);
|
||||||
motor_power_off(MotorYaw);
|
motor_power_off(MotorYaw);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '*':
|
case '*': // turn motors on
|
||||||
motor_power_on(MotorPitch);
|
motor_power_on(MotorPitch);
|
||||||
motor_power_on(MotorYaw);
|
motor_power_on(MotorYaw);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm': // move to a specific position in yawl
|
||||||
Serial.print(F("Move "));
|
Serial.print(F("Move "));
|
||||||
Serial.print(args[0]);
|
Serial.print(args[0]);
|
||||||
Serial.print(F(" with "));
|
Serial.print(F(" with "));
|
||||||
|
|
@ -62,11 +56,11 @@ void parser(char &c) {
|
||||||
tmc5160_moveTo(MotorYaw, args[0], args[1]);
|
tmc5160_moveTo(MotorYaw, args[0], args[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ';':
|
case ';': // change position homing (0x21: XACTUAL register)
|
||||||
tmc5160_writeRegister(MotorYaw, 0x21, args[0]);
|
tmc5160_writeRegister(MotorYaw, 0x21, args[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's': // stop motors
|
||||||
tmc5160_rotateMotor(MotorPitch, 0);
|
tmc5160_rotateMotor(MotorPitch, 0);
|
||||||
tmc5160_rotateMotor(MotorYaw, 0);
|
tmc5160_rotateMotor(MotorYaw, 0);
|
||||||
Serial.println(F("Stop"));
|
Serial.println(F("Stop"));
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
"
|
||||||
Reference in New Issue