From 018e7c16a5f0ece4fa0df32e378a486808636ca6 Mon Sep 17 00:00:00 2001 From: dan Date: Sun, 23 Jul 2023 00:34:08 +0200 Subject: [PATCH] DC use brake relay|release 20230722 --- README.md | 1 + ip-rot.ino | 176 +++++++++++++++++++++++++++++++++-------------------- 2 files changed, 110 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index a5d3533..4735113 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # IP-rotator firmware +- Manual available on the [Wiki page](https://remoteqth.com/w/doku.php?id=simple_rotator_interface_v) - MQTT based IP control firmware, for 3D printed rotator - Web preview - Main repository [Parameterizable 3D print Antenna rotator in OpenScad](https://github.com/ok1hra/Parameterizable-3D-print-Antenna-rotator-in-OpenScad) diff --git a/ip-rot.ino b/ip-rot.ino index ec88e72..3a6188d 100644 --- a/ip-rot.ino +++ b/ip-rot.ino @@ -70,19 +70,19 @@ Changelog: + rename PWR to POE on main control page + reset button for calibrate settings in setup + calibrate control potentiometer on north (show ° in setup gui) ++ DC use brake relay ToDo -- PWM up/dwn ramp long to setup page, and ° before target start PWM (measure and saved) -- DC without PWM for high voltage motor +- test + - if stop, after run over target + + 10 turn pot without preamp + + test preamp linearity + +- HW rev 06 - change POE voltage limit with enable AMP to 13,0V (2V dropout 11V LDO) +- PWM up/dwn ramp long to setup page, and ° before target start PWM (measure and saved) - PwmDwnDelay/PwmUpDelay set from setup gui - save settings (dump eeprom?) -- test - if stop, after run over target - - 10 turn pot without preamp - - test preamp linearity - - maximum PWM voltage - - web fw upload - show target from az pot in map - disable target in map if status = 0 (not rotate) -- PwmDwnDelay/PwmUpDelay set from setup gui - need implement - CW/CCW pulse functionality - CW/CCW pulse pulse per grad @@ -111,7 +111,7 @@ Použití knihovny Wire ve verzi 2.0.0 v adresáři: /home/dan/Arduino/hardware/ */ //------------------------------------------------------------------------------------------------------- -const char* REV = "20230603"; +const char* REV = "20230722"; // #define CN3A // fix ip float NoEndstopHighZone = 0; @@ -412,13 +412,17 @@ char mqttPath[MqttBuferSize]; long MqttStatusTimer[2]{1500,1000}; long HeartBeatTimer[2]={0,1000}; -// WX pinout -const int ShiftInDataPin = 0; // to rev0.3 13 -const int ShiftInLatchPin = 0; -const int ShiftInClockPin = 0; -bool rxShiftInRead; +// Shift register +// CC1 12 CLOCK +// CC2 13 DATA +// SBU1 14 LATCH +// SBU2 15 +// const int ShiftOutClockPin = 12; +// const int ShiftOutDataPin = 13; +// const int ShiftOutLatchPin = 14; +// byte ShiftOutByte=0x00; -byte ShiftOutByte[3]; +bool rxShiftInRead; // https://randomnerdtutorials.com/esp32-i2c-communication-arduino-ide/ #include #define I2C_SDA 33 @@ -642,6 +646,11 @@ void setup() { pinMode(AZpreampPin, OUTPUT); digitalWrite(AZpreampPin, LOW); + // pinMode(ShiftOutClockPin, OUTPUT); + // pinMode(ShiftOutDataPin, OUTPUT); + // pinMode(ShiftOutLatchPin, OUTPUT); + // digitalWrite(ShiftOutLatchPin, HIGH); + // for (int i = 0; i < 8; i++) { // pinMode(TestPin[i], INPUT); // } @@ -659,9 +668,9 @@ void setup() { // pinMode(ButtonPin, INPUT); // SHIFT IN - pinMode(ShiftInLatchPin, OUTPUT); - pinMode(ShiftInClockPin, OUTPUT); - pinMode(ShiftInDataPin, INPUT); + // pinMode(ShiftInLatchPin, OUTPUT); + // pinMode(ShiftInClockPin, OUTPUT); + // pinMode(ShiftInDataPin, INPUT); Serial.begin(115200); //BaudRate while(!Serial) { @@ -1046,11 +1055,11 @@ void setup() { if(OutputWatchdog>10080){ OutputWatchdog=0; } - if(RebootWatchdog>0){ - ShiftOutByte[0]=EEPROM.readByte(34); - ShiftOutByte[1]=EEPROM.readByte(35); - ShiftOutByte[2]=EEPROM.readByte(36); - } + // if(RebootWatchdog>0){ + // ShiftOutByte[0]=EEPROM.readByte(34); + // ShiftOutByte[1]=EEPROM.readByte(35); + // ShiftOutByte[2]=EEPROM.readByte(36); + // } TelnetServerClientAuth[0]=EEPROM.readByte(37); TelnetServerClientAuth[1]=EEPROM.readByte(38); TelnetServerClientAuth[2]=EEPROM.readByte(39); @@ -1364,8 +1373,8 @@ void loop() { // CLI(); CLI2(); Telnet(); - Watchdog(); RunByStatus(); + Watchdog(); ajaxserver.handleClient(); @@ -1380,9 +1389,26 @@ void loop() { // }); AsyncElegantOTA.loop(); #endif + + + // shift register test + // for (int i=0; i<8; i++){ + // bitSet(ShiftOutByte, i); + // ShiftOutSet(ShiftOutByte); + // bitClear(ShiftOutByte, i); + // delay(100); + // } + } // SUBROUTINES ------------------------------------------------------------------------------------------------------- +// void ShiftOutSet(byte SetByte){ +// digitalWrite(ShiftOutLatchPin, LOW); +// shiftOut(ShiftOutDataPin, ShiftOutClockPin, LSBFIRST, SetByte); +// digitalWrite(ShiftOutLatchPin, HIGH); +// } + +//------------------------------------------------------------------------------------------------------- uint32_t readADC_Cal(int ADC_Raw) { esp_adc_cal_characteristics_t adc_chars; @@ -1469,16 +1495,16 @@ void Watchdog(){ static bool RunByKey = false; if(CwCcwInputValue==1 && Status>=0){ if(Status==0){ - Status=1; digitalWrite(BrakePin, HIGH); delay(24); + Status=1; //digitalWrite(BrakePin, HIGH); delay(24); RunByKey=true; } - RunTimer(); + // RunTimer(); }else if(CwCcwInputValue==2 && Status<=0){ if(Status==0){ - Status=-1; digitalWrite(BrakePin, HIGH); delay(24); + Status=-1; //digitalWrite(BrakePin, HIGH); delay(24); RunByKey=true; } - RunTimer(); + // RunTimer(); }else if(RunByKey==true){ if(Status==-2){ Status=-3; @@ -1618,9 +1644,9 @@ void Watchdog(){ if(OutputWatchdog > 0 && millis()-WatchdogTimer > OutputWatchdog*60000 && OutputWatchdog < 123456){ Prn(3, 1,"** Activate clear output watchdog **"); - ShiftOutByte[0]=0x00; - ShiftOutByte[1]=0x00; - ShiftOutByte[2]=0x00; + // ShiftOutByte[0]=0x00; + // ShiftOutByte[1]=0x00; + // ShiftOutByte[2]=0x00; // EEPROM.writeByte(34, ShiftOutByte[0]); // EEPROM.writeByte(35, ShiftOutByte[1]); // EEPROM.writeByte(36, ShiftOutByte[2]); @@ -1718,20 +1744,20 @@ void RotCalculate(){ // direction if(AzimuthTarget>=0 && AzimuthTarget <=MaxRotateDegree){ if(AzimuthTarget>Azimuth){ - Status=1; digitalWrite(BrakePin, HIGH); delay(24); - RunTimer(); + Status=1; //digitalWrite(BrakePin, HIGH); delay(24); + // RunTimer(); }else{ - Status=-1; digitalWrite(BrakePin, HIGH); delay(24); - RunTimer(); + Status=-1; //digitalWrite(BrakePin, HIGH); delay(24); + // RunTimer(); } // escape from the forbidden zone }else if(Azimuth<0 && AzimuthTarget>0){ - Status=1; digitalWrite(BrakePin, HIGH); delay(24); - RunTimer(); + Status=1; //digitalWrite(BrakePin, HIGH); delay(24); + // RunTimer(); }else if(Azimuth>MaxRotateDegree && AzimuthTargetNoEndstopLowZone){ // run @@ -1762,7 +1788,7 @@ void DetectEndstopZone(){ } } } - if(Status==1 || Status==2){ // run status CW + if(Status==1 || Status==11 || Status==2){ // run status CW if(CcwRaw"; - HtmlSrc +="After change, refresh all other page for apply changes.
More on Wiki ➚\n"; + HtmlSrc +="After change, refresh all other page for apply changes.
More on Wiki ➚\n"; HtmlSrc +="\n"; ajaxserver.send(200, "text/html", HtmlSrc); //Send web page @@ -4816,13 +4858,13 @@ void handleCal() { } if ( ajaxserver.hasArg("cw")==1 ){ - Status=1; digitalWrite(BrakePin, HIGH); delay(24); - RunTimer(); + Status=1; //digitalWrite(BrakePin, HIGH); delay(24); + // RunTimer(); } if ( ajaxserver.hasArg("ccw")==1 ){ - Status=-1; digitalWrite(BrakePin, HIGH); delay(24); - RunTimer(); + Status=-1; //digitalWrite(BrakePin, HIGH); delay(24); + // RunTimer(); } if ( ajaxserver.hasArg("reverse")==1 ){ @@ -4974,7 +5016,7 @@ void handleCal() { HtmlSrc +="Panel value 0
"; HtmlSrc +="
Instruction:

• Rotate front panel potentiometer axis without knob to value 0°
• Put knob with orientation to north on axis
• Fixate knob to axis on position north"; - HtmlSrc +="

More on Wiki ➚

"; + HtmlSrc +="

More on Wiki ➚

"; String s = CAL_page; //Read HTML contents HtmlSrc +=s;