From a65394bfc1c409ce0b7ef73c23000ac0ebd6ffee Mon Sep 17 00:00:00 2001 From: tp2043 Date: Mon, 10 Apr 2023 06:12:43 +0000 Subject: [PATCH] Updated file - better movement. No noise. Z axis problem rectified. Serial... --- src/firmware/SICKLESCOPE_NEW_CODE_CYTOCUBE3.ino | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/firmware/SICKLESCOPE_NEW_CODE_CYTOCUBE3.ino b/src/firmware/SICKLESCOPE_NEW_CODE_CYTOCUBE3.ino index c38a902..652b92a 100644 --- a/src/firmware/SICKLESCOPE_NEW_CODE_CYTOCUBE3.ino +++ b/src/firmware/SICKLESCOPE_NEW_CODE_CYTOCUBE3.ino @@ -1,8 +1,9 @@ /************************************************************************************** ************************************************************************************** - * Date: 27/03/2023 - * File Name: CytoCube v1.3 - * Description: All glitches fixed + * Date: 03/04/2023 + * File Name: CytoCube v1.3.1 + * Description: Autofocus glitch resolution - Serial buffer had to be cleared from + * python code. Reduced fast forward functionality to 1/8 instead. ************************************************************************************** *************************************************************************************/ #include @@ -75,7 +76,8 @@ void setup() { } void loop() { - if(Serial.available()){ + Serial.flush(); + if(Serial.available()>0){ int choice = Serial.read(); switch (choice) { @@ -505,9 +507,9 @@ void changeMode(){ // zstate = digitalRead(Zenable); // // digitalWrite(Xenable, HIGH); digitalWrite(Yenable, HIGH); digitalWrite(Zenable, HIGH); - digitalWrite(8, LOW); digitalWrite(9, HIGH); digitalWrite(10, LOW); // Probably due to voltage issues x axis motor won't go for steps larger than 1/4. So 1/4, 1/8, 1/16, 1/32 all work. - digitalWrite(14, LOW); digitalWrite(2, HIGH); digitalWrite(3, LOW); // Working with 1/4 step mode for noise removal - digitalWrite(32, LOW); digitalWrite(30, HIGH); digitalWrite(28, LOW); + digitalWrite(8, HIGH); digitalWrite(9, HIGH); digitalWrite(10, LOW); // Probably due to voltage issues x axis motor won't go for steps larger than 1/4. So 1/4, 1/8, 1/16, 1/32 all work. + digitalWrite(14, HIGH); digitalWrite(2, HIGH); digitalWrite(3, LOW); // Working with 1/8 step mode for noise removal, jerk reduction, even though 1/4 does the job fairly well + digitalWrite(32, HIGH); digitalWrite(30, HIGH); digitalWrite(28, LOW); // digitalWrite(Xenable, xstate); digitalWrite(Yenable, ystate); digitalWrite(Zenable, zstate); //T = ;