diff --git a/AstroEQ-ConfigUtility/hex/AstroEQATMega162Based(Legacy).hex b/AstroEQ-ConfigUtility/hex/AstroEQATMega162Based(Legacy).hex index a12a177e116662d32349e998f5be82cd25b9ee4b..a90e1755874999103b4bf4186c9d90b3ef80bd81 100644 Binary files a/AstroEQ-ConfigUtility/hex/AstroEQATMega162Based(Legacy).hex and b/AstroEQ-ConfigUtility/hex/AstroEQATMega162Based(Legacy).hex differ diff --git a/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega1280(Legacy).hex b/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega1280(Legacy).hex index af9f8c997b1c64bd08adf4e6bb0fa6ad08308225..fd4da84966475df75298ff8bf038eabc514f083d 100644 Binary files a/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega1280(Legacy).hex and b/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega1280(Legacy).hex differ diff --git a/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega2560(Legacy).hex b/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega2560(Legacy).hex index 732e63d7a0a657dd6fedc793b07a91d6ff772fdc..b9ae4eef5fcaf1cad2c683bd86c2591a96bb59d5 100644 Binary files a/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega2560(Legacy).hex and b/AstroEQ-ConfigUtility/hex/AstroEQArduinoMega2560(Legacy).hex differ diff --git a/AstroEQ-ConfigUtility/hex/AstroEQV4-DIYBoard(includingKits).hex b/AstroEQ-ConfigUtility/hex/AstroEQV4-DIYBoard(includingKits).hex index 11809d7b8fa19bf04076fe313fb7626b3147de32..4e588f6eb59af43f0e5f0e04762f91393e4d54c5 100644 Binary files a/AstroEQ-ConfigUtility/hex/AstroEQV4-DIYBoard(includingKits).hex and b/AstroEQ-ConfigUtility/hex/AstroEQV4-DIYBoard(includingKits).hex differ diff --git a/AstroEQ-ConfigUtility/hex/AstroEQV4-EQ5Board.hex b/AstroEQ-ConfigUtility/hex/AstroEQV4-EQ5Board.hex index 11809d7b8fa19bf04076fe313fb7626b3147de32..4e588f6eb59af43f0e5f0e04762f91393e4d54c5 100644 Binary files a/AstroEQ-ConfigUtility/hex/AstroEQV4-EQ5Board.hex and b/AstroEQ-ConfigUtility/hex/AstroEQV4-EQ5Board.hex differ diff --git a/AstroEQ-Firmware/AstroEQ6.ino b/AstroEQ-Firmware/AstroEQ6.ino index cfdde1177cf14b92b849fd19b22d58438f38a7c6..1acaa30bd2036a9dff7bb68329a9372136a1a94b 100644 --- a/AstroEQ-Firmware/AstroEQ6.ino +++ b/AstroEQ-Firmware/AstroEQ6.ino @@ -9,7 +9,7 @@ Works with EQ5, HEQ5, and EQ6 mounts (Not EQ3-2, they have a different gear ratio) - Current Verison: 6.2 + Current Verison: 6.3 */ //Only works with ATmega162, and Arduino Mega boards (1280 and 2560) @@ -30,7 +30,7 @@ Synta synta = Synta::getInstance(1281); //create a mount instance, specify versi #define RA 0 //Right Ascension is AstroEQ axis 0 (Synta axis '1') #define DC 1 //Declination is AstroEQ axis 1 (Synta axis '2') -#define DEBUG 2 +//#define DEBUG 1 unsigned int normalGotoSpeed[2]; unsigned int gotoFactor[2]; unsigned int minSpeed[2]; @@ -344,6 +344,11 @@ void decodeCommand(char command, char* packetIn){ //each command is axis specifi Serial1.print(F(" ->Res:")); Serial1.println(response); } +#if DEBUG == 2 + else { + Serial.println(); + } +#endif #endif if(command == 'J'){ //J tells @@ -511,7 +516,6 @@ inline void timerDisable(byte motor) { void motorStart(byte motor, byte gotoDeceleration){ digitalWrite(dirPin[motor],encodeDirection[motor]^synta.cmd.dir[motor]); //set the direction - synta.cmd.setStopped(motor, 0); #ifdef DEBUG Serial1.println(F("IVal:")); @@ -526,6 +530,11 @@ void motorStart(byte motor, byte gotoDeceleration){ startSpeed = 650; //if possible start closer to the target speed to avoid *very* long accelleration times. } stopSpeed[motor] = startSpeed; + if(!synta.cmd.stopped[motor]){ + //if we are still running, then we have been caught in the middle of decelleration. + startSpeed = currentMotorSpeed(motor); //so make the start speed our current speed. This means we will continue decellerating to new speed. + //note that stopSpeed[] does not get changed. + } #ifdef DEBUG Serial1.println(F("StartSpeed:")); Serial1.println(startSpeed); @@ -536,10 +545,13 @@ void motorStart(byte motor, byte gotoDeceleration){ currentMotorSpeed(motor) = startSpeed;//minSpeed[motor]; distributionSegment(motor) = 0; decelerationSteps(motor) = -gotoDeceleration; - timerCountRegister(motor) = 0; - interruptControlRegister(motor) |= interruptControlBitMask(motor); - interruptOVFCount(motor) = timerOVF[motor][0]; - timerEnable(motor,highSpeed[motor]); + if(synta.cmd.stopped[motor]){ //if not stopped, then timer is already enabled + timerCountRegister(motor) = 0; + interruptControlRegister(motor) |= interruptControlBitMask(motor); + interruptOVFCount(motor) = timerOVF[motor][0]; + timerEnable(motor,highSpeed[motor]); + } + synta.cmd.setStopped(motor, 0); } void motorStop(byte motor, byte emergency){ diff --git a/AstroEQ-Firmware/commands.h b/AstroEQ-Firmware/commands.h index c0b9aad912fc0d3942169eddff66f11f07343297..eac07d52675a0d586e86289e7a6667e2441111db 100644 --- a/AstroEQ-Firmware/commands.h +++ b/AstroEQ-Firmware/commands.h @@ -36,14 +36,14 @@ //Methods for accessing class variables void setStepLength(byte target, byte stepLength); //in highspeed mode, one step is gVal increments of the jVal. - void setDir(byte target, byte _dir); //Get Method - void setStopped(byte target, byte _stopped); //Get Method + void setDir(byte target, byte _dir); //Set Method + void setStopped(byte target, byte _stopped); //Set Method void setGotoEn(byte target, byte _gotoEn); //Set Method - void setFVal(byte target, byte _FVal); //Get Method - void setjVal(byte target, unsigned long _jVal); //set Method - void setIVal(byte target, unsigned int _IVal); //set Method - void setHVal(byte target, unsigned long _HVal); //set Method - void setGVal(byte target, byte _GVal); //Get Method + void setFVal(byte target, byte _FVal); //Set Method + void setjVal(byte target, unsigned long _jVal); //Set Method + void setIVal(byte target, unsigned int _IVal); //Set Method + void setHVal(byte target, unsigned long _HVal); //Set Method + void setGVal(byte target, byte _GVal); //Set Method char getLength(char cmd, boolean sendRecieve); diff --git a/Downloads/AstroEQ6-ConfigUtility.zip b/Downloads/AstroEQ6-ConfigUtility.zip index bbce5f22afc8af0733eb034438a618eab1eefc7d..d680e523a01d71ac424d230b1bef1ea79cc9b937 100644 Binary files a/Downloads/AstroEQ6-ConfigUtility.zip and b/Downloads/AstroEQ6-ConfigUtility.zip differ diff --git a/Downloads/AstroEQ6-Firmware.zip b/Downloads/AstroEQ6-Firmware.zip index 97f0959df3c640424da4f3d51a07f74bcc04e928..e4121b4c2c9a09716c6e71aa46483885f58d6603 100644 Binary files a/Downloads/AstroEQ6-Firmware.zip and b/Downloads/AstroEQ6-Firmware.zip differ