From fc671a4f13ada4b827e3f473aef417d524433a9b Mon Sep 17 00:00:00 2001 From: Pierros Papadeas Date: Sat, 10 May 2014 19:39:13 +0300 Subject: [PATCH] Cleaning up project structure --- arduino/{ => SatNOGS-v1}/SatNOGS.ino | 0 arduino/{ => SatNOGS-v1}/Serial.ino | 3 ++- arduino/{ => SatNOGS-v1}/Stepper.ino | 26 +------------------------- 3 files changed, 3 insertions(+), 26 deletions(-) rename arduino/{ => SatNOGS-v1}/SatNOGS.ino (100%) rename arduino/{ => SatNOGS-v1}/Serial.ino (94%) rename arduino/{ => SatNOGS-v1}/Stepper.ino (61%) diff --git a/arduino/SatNOGS.ino b/arduino/SatNOGS-v1/SatNOGS.ino similarity index 100% rename from arduino/SatNOGS.ino rename to arduino/SatNOGS-v1/SatNOGS.ino diff --git a/arduino/Serial.ino b/arduino/SatNOGS-v1/Serial.ino similarity index 94% rename from arduino/Serial.ino rename to arduino/SatNOGS-v1/Serial.ino index dd49521..39076af 100644 --- a/arduino/Serial.ino +++ b/arduino/SatNOGS-v1/Serial.ino @@ -19,12 +19,13 @@ void cmd_proc() strncpy(data, buffer+2, 100); double cmdAz = atof(data); - stepAz = path(cmdAz); + stepAz = deg2step(cmdAz)-stepPosAz; } else if (buffer[0] == 'E' && buffer[1] == 'L') { strncpy(data, buffer+2, 10); double cmdEl = atof(data); + stepEl = deg2step(cmdEl)-stepPosEl; } else if (buffer[0] == 'S' && buffer[1] == 'A') diff --git a/arduino/Stepper.ino b/arduino/SatNOGS-v1/Stepper.ino similarity index 61% rename from arduino/Stepper.ino rename to arduino/SatNOGS-v1/Stepper.ino index ab53ff9..1f0c3a0 100644 --- a/arduino/Stepper.ino +++ b/arduino/SatNOGS-v1/Stepper.ino @@ -4,7 +4,7 @@ void stepper_move() { digitalWrite(DIR_AZ, HIGH); digitalWrite(STEP_AZ, HIGH); - stepPosAz++; + stepPosAz++; stepAz--; } else if(stepAz<0) @@ -14,10 +14,6 @@ void stepper_move() stepPosAz--; stepAz++; } - if (stepPosAz > SPD*60) - stepPosAz = 0; - else if (stepPosAz < 0) - stepPosAz = SPD*60; if(stepEl>0) { @@ -41,26 +37,6 @@ void stepper_move() } -int path( double cmdAz) -{ - int sign = 0, stepTemp; - double PosAz = cmdAz - step2deg(stepPosAz); - double distAz = abs(PosAz); - - if (distAz < 180) - stepAz = deg2step(PosAz); - else - { - if (PosAz > 0) - sign = -1; - else - sign = 1; - stepTemp = deg2step((360-PosAz)*sign); - } - - return stepTemp; -} - int deg2step(double deg) { return(60*SPD*deg/360); -- GitLab