From eb6d80456b8afb0f6c4a5fb4ff34aa5c7cdb53ed Mon Sep 17 00:00:00 2001 From: SK21 Date: Thu, 25 Jan 2024 21:20:36 -0600 Subject: [PATCH] define pin not connected --- Modules/ESP32 Rate/RC_ESP32/RC_ESP32.ino | 13 +++++++------ Modules/ESP32 Rate/RC_ESP32/RC_ESP32.vcxproj | 5 +++++ Modules/ESP32 Rate/RC_ESP32/Relays.ino | 6 +++--- Modules/Nano/RCnano/RCnano.ino | 5 +++-- Modules/Nano/RCnano/RCnano.vcxproj | 2 +- Modules/Nano/RCnano/Relays.ino | 2 +- Modules/Nano/RCnano/__vm/Compile.vmps.xml | 4 ++-- Modules/Teensy Rate/RCteensy/RCteensy.ino | 3 ++- Modules/Teensy Rate/RCteensy/RCteensy.vcxproj | 2 +- Modules/Teensy Rate/RCteensy/Relays.ino | 2 +- 10 files changed, 26 insertions(+), 18 deletions(-) diff --git a/Modules/ESP32 Rate/RC_ESP32/RC_ESP32.ino b/Modules/ESP32 Rate/RC_ESP32/RC_ESP32.ino index 3532973d..27ba75a4 100644 --- a/Modules/ESP32 Rate/RC_ESP32/RC_ESP32.ino +++ b/Modules/ESP32 Rate/RC_ESP32/RC_ESP32.ino @@ -27,8 +27,8 @@ #include // https://github.com/pangodream/ESP2SOTA // rate control with ESP32 board: DOIT ESP32 DEVKIT V1 -# define InoDescription "RC_ESP32 : 24-Jan-2024" -const uint16_t InoID = 24014; // change to send defaults to eeprom, ddmmy, no leading 0 +# define InoDescription "RC_ESP32 : 25-Jan-2024" +const uint16_t InoID = 25014; // change to send defaults to eeprom, ddmmy, no leading 0 const uint8_t InoType = 4; // 0 - Teensy AutoSteer, 1 - Teensy Rate, 2 - Nano Rate, 3 - Nano SwitchBox, 4 - ESP Rate #define MaxReadBuffer 100 // bytes @@ -40,6 +40,8 @@ const uint8_t InoType = 4; // 0 - Teensy AutoSteer, 1 - Teensy Rate, 2 - Nano R #define OutputEnablePin 27 #define DriverAddress 0x55 +#define NC 0xFF // Pins are not connected + struct ModuleConfig { uint8_t ID = 0; @@ -51,7 +53,7 @@ struct ModuleConfig uint8_t IP2 = 5; uint8_t IP3 = 60; uint8_t RelayControl = 1; // 0 - no relays, 1 - PCA9685, 2 - PCA9555 8 relays, 3 - PCA9555 16 relays, 4 - MCP23017, 5 - Teensy GPIO - uint8_t RelayPins[16] = { 8,9,10,11,12,25,26,27,0,0,0,0,0,0,0,0 }; // pin numbers when GPIOs are used for relay control (5), default RC11 + uint8_t RelayPins[16] = { 8,9,10,11,12,25,26,27,NC,NC,NC,NC,NC,NC,NC,NC }; // pin numbers when GPIOs are used for relay control (5), default RC11 char Name[ModStringLengths] = "RateModule"; char Password[ModStringLengths] = "111222333"; uint8_t AdsAddress = 0x48; // enter 0 to search all @@ -135,8 +137,6 @@ bool PCA9685_found = false; Adafruit_MCP23X17 MCP; bool MCP23017_found = false; -int TimedCombo(byte, bool); // function prototype - // analog struct AnalogConfig { @@ -150,7 +150,8 @@ AnalogConfig AINs; int ADS1115_Address; bool ADSfound = false; -void IRAM_ATTR ISR0(); // function prototype +int TimedCombo(byte, bool); // function prototype +void IRAM_ATTR ISR0(); // function prototype void IRAM_ATTR ISR1(); void setup() diff --git a/Modules/ESP32 Rate/RC_ESP32/RC_ESP32.vcxproj b/Modules/ESP32 Rate/RC_ESP32/RC_ESP32.vcxproj index 2bc6ab24..366c9d3d 100644 --- a/Modules/ESP32 Rate/RC_ESP32/RC_ESP32.vcxproj +++ b/Modules/ESP32 Rate/RC_ESP32/RC_ESP32.vcxproj @@ -154,4 +154,9 @@ + + + + + \ No newline at end of file diff --git a/Modules/ESP32 Rate/RC_ESP32/Relays.ino b/Modules/ESP32 Rate/RC_ESP32/Relays.ino index bbde0518..b151232e 100644 --- a/Modules/ESP32 Rate/RC_ESP32/Relays.ino +++ b/Modules/ESP32 Rate/RC_ESP32/Relays.ino @@ -61,13 +61,13 @@ void CheckRelays() if (BitState) { // on - PWMServoDriver.setPWM(IOpin, 4096, 0); + PWMServoDriver.setPWM(IOpin, 4096, 0); PWMServoDriver.setPWM(IOpin + 1, 0, 4096); } else { // off - PWMServoDriver.setPWM(IOpin, 0, 4096); + PWMServoDriver.setPWM(IOpin, 0, 4096); PWMServoDriver.setPWM(IOpin + 1, 4096, 0); } RelayStatus[i] = BitState; @@ -199,7 +199,7 @@ void CheckRelays() if (j < 1) Rlys = NewLo; else Rlys = NewHi; for (int i = 0; i < 8; i++) { - if (MDL.RelayPins[i + j * 8] > 1) // check if relay is enabled + if (MDL.RelayPins[i + j * 8] < NC) // check if relay is enabled { if (bitRead(Rlys, i)) digitalWrite(MDL.RelayPins[i + j * 8], MDL.RelayOnSignal); else digitalWrite(MDL.RelayPins[i + j * 8], !MDL.RelayOnSignal); } diff --git a/Modules/Nano/RCnano/RCnano.ino b/Modules/Nano/RCnano/RCnano.ino index c0ab1a81..0b7189d6 100644 --- a/Modules/Nano/RCnano/RCnano.ino +++ b/Modules/Nano/RCnano/RCnano.ino @@ -15,11 +15,12 @@ #include "PCA95x5_RC.h" // modified from https://github.com/hideakitai/PCA95x5 // rate control with nano -# define InoDescription "RCnano : 09-Jan-2024" -const uint16_t InoID = 9014; // change to send defaults to eeprom, ddmmy, no leading 0 +# define InoDescription "RCnano : 25-Jan-2024" +const uint16_t InoID = 25014; // change to send defaults to eeprom, ddmmy, no leading 0 const uint8_t InoType = 2; // 0 - Teensy AutoSteer, 1 - Teensy Rate, 2 - Nano Rate, 3 - Nano SwitchBox, 4 - ESP Rate #define MaxProductCount 2 +#define NC 0xFF // Pins are not connected struct ModuleConfig { diff --git a/Modules/Nano/RCnano/RCnano.vcxproj b/Modules/Nano/RCnano/RCnano.vcxproj index 3bd3921c..a69ddb7f 100644 --- a/Modules/Nano/RCnano/RCnano.vcxproj +++ b/Modules/Nano/RCnano/RCnano.vcxproj @@ -165,7 +165,7 @@ gnu11 - $(ProjectDir)..\..\..\..\..\..\..\..\..\program files\microsoft visual studio\2022\community\common7\ide\extensions\k5efmrr3.kil\Micro Platforms\default\vm-intelli-pre.h;$(ProjectDir)..\..\..\..\..\..\..\AppData\Local\Temp\VMBuilds\RCnano\nano_atmega328old\Debug\.vmintelli\0e5dc040bf83638b37e9b4f44d8f0d4f\vm-intelli-gcc-defines.h;$(ProjectDir)..\..\..\..\..\..\..\..\..\program files\microsoft visual studio\2022\community\common7\ide\extensions\k5efmrr3.kil\Micro Platforms\default\vm-intelli-post.h;$(ProjectDir)__vm\.RCnano.vsarduino.h;%(ForcedIncludeFiles) + $(ProjectDir)..\..\..\..\..\..\..\..\..\program files\microsoft visual studio\2022\community\common7\ide\extensions\osqpjdds.xje\Micro Platforms\default\vm-intelli-pre.h;$(ProjectDir)..\..\..\..\..\..\..\AppData\Local\Temp\VMBuilds\RCnano\nano_atmega328old\Debug\.vmintelli\e19cb606e213da4d9d21600d75253b96\vm-intelli-gcc-defines.h;$(ProjectDir)..\..\..\..\..\..\..\..\..\program files\microsoft visual studio\2022\community\common7\ide\extensions\osqpjdds.xje\Micro Platforms\default\vm-intelli-post.h;$(ProjectDir)__vm\.RCnano.vsarduino.h;%(ForcedIncludeFiles) true true _VMICRO_INTELLISENSE;__AVR_atmega328p__;__AVR_ATmega328P__;__AVR_ATmega328p__;F_CPU=16000000L;ARDUINO=108019;ARDUINO_AVR_NANO;ARDUINO_ARCH_AVR;%(PreprocessorDefinitions) diff --git a/Modules/Nano/RCnano/Relays.ino b/Modules/Nano/RCnano/Relays.ino index 380ff7b1..bb2d0e46 100644 --- a/Modules/Nano/RCnano/Relays.ino +++ b/Modules/Nano/RCnano/Relays.ino @@ -116,7 +116,7 @@ void CheckRelays() if (j < 1) Rlys = NewLo; else Rlys = NewHi; for (int i = 0; i < 8; i++) { - if (MDL.RelayPins[i + j * 8] > 1) // check if relay is enabled + if (MDL.RelayPins[i + j * 8] < NC) // check if relay is enabled { if (bitRead(Rlys, i)) digitalWrite(MDL.RelayPins[i + j * 8], MDL.RelayOnSignal); else digitalWrite(MDL.RelayPins[i + j * 8], !MDL.RelayOnSignal); } diff --git a/Modules/Nano/RCnano/__vm/Compile.vmps.xml b/Modules/Nano/RCnano/__vm/Compile.vmps.xml index 1089853f..76dd029f 100644 --- a/Modules/Nano/RCnano/__vm/Compile.vmps.xml +++ b/Modules/Nano/RCnano/__vm/Compile.vmps.xml @@ -1,8 +1,8 @@ - + - + diff --git a/Modules/Teensy Rate/RCteensy/RCteensy.ino b/Modules/Teensy Rate/RCteensy/RCteensy.ino index 74212dc7..e8c57127 100644 --- a/Modules/Teensy Rate/RCteensy/RCteensy.ino +++ b/Modules/Teensy Rate/RCteensy/RCteensy.ino @@ -22,6 +22,7 @@ const uint8_t InoType = 1; // 0 - Teensy AutoSteer, 1 - Teensy Rate, 2 - Nano R #define MaxReadBuffer 100 // bytes #define MaxProductCount 2 +#define NC 0xFF // Pins are not connected struct ModuleConfig { @@ -35,7 +36,7 @@ struct ModuleConfig uint8_t IP3 = 60; uint8_t RelayControl = 5; // 0 - no relays, 1 - RS485, 2 - PCA9555 8 relays, 3 - PCA9555 16 relays, 4 - MCP23017, 5 - Teensy GPIO uint8_t ESPserialPort = 1; // serial port to connect to wifi module - uint8_t RelayPins[16] = { 8,9,10,11,12,25,26,27,0,0,0,0,0,0,0,0 }; // pin numbers when GPIOs are used for relay control (5), default RC11 + uint8_t RelayPins[16] = { 8,9,10,11,12,25,26,27,NC,NC,NC,NC,NC,NC,NC,NC }; // pin numbers when GPIOs are used for relay control (5), default RC11 }; ModuleConfig MDL; diff --git a/Modules/Teensy Rate/RCteensy/RCteensy.vcxproj b/Modules/Teensy Rate/RCteensy/RCteensy.vcxproj index 7baf19b8..7f068800 100644 --- a/Modules/Teensy Rate/RCteensy/RCteensy.vcxproj +++ b/Modules/Teensy Rate/RCteensy/RCteensy.vcxproj @@ -151,7 +151,7 @@ gnu11 - $(ProjectDir)..\..\..\..\..\..\..\..\..\program files\microsoft visual studio\2022\community\common7\ide\extensions\k5efmrr3.kil\Micro Platforms\default\vm-intelli-pre.h;$(ProjectDir)..\..\..\..\..\..\..\AppData\Local\Temp\VMBuilds\RCteensy\teensy41\Release\.vmintelli\2be9fd39c8b35a25180fc6dbc3d07884\vm-intelli-gcc-defines.h;$(ProjectDir)..\..\..\..\..\..\..\..\..\program files\microsoft visual studio\2022\community\common7\ide\extensions\k5efmrr3.kil\Micro Platforms\default\vm-intelli-post.h;$(ProjectDir)__vm\.RCteensy.vsarduino.h;%(ForcedIncludeFiles) + $(ProjectDir)..\..\..\..\..\..\..\..\..\program files\microsoft visual studio\2022\community\common7\ide\extensions\osqpjdds.xje\Micro Platforms\default\vm-intelli-pre.h;$(ProjectDir)..\..\..\..\..\..\..\AppData\Local\Temp\VMBuilds\RCteensy\teensy41\Release\.vmintelli\4e03964cb693f7bd0cccd297cb53f368\vm-intelli-gcc-defines.h;$(ProjectDir)..\..\..\..\..\..\..\..\..\program files\microsoft visual studio\2022\community\common7\ide\extensions\osqpjdds.xje\Micro Platforms\default\vm-intelli-post.h;$(ProjectDir)__vm\.RCteensy.vsarduino.h;%(ForcedIncludeFiles) true true _VMICRO_INTELLISENSE;__HARDWARE_imxrt1062__;__HARDWARE_IMXRT1062__;__IMXRT1062__;TEENSYDUINO=156;ARDUINO=108019;ARDUINO_TEENSY41;F_CPU=600000000;USB_SERIAL;LAYOUT_US_ENGLISH;%(PreprocessorDefinitions) diff --git a/Modules/Teensy Rate/RCteensy/Relays.ino b/Modules/Teensy Rate/RCteensy/Relays.ino index 7b38a1aa..7d1436a2 100644 --- a/Modules/Teensy Rate/RCteensy/Relays.ino +++ b/Modules/Teensy Rate/RCteensy/Relays.ino @@ -145,7 +145,7 @@ void CheckRelays() if (j < 1) Rlys = NewLo; else Rlys = NewHi; for (int i = 0; i < 8; i++) { - if (MDL.RelayPins[i + j * 8] > 1) // check if relay is enabled + if (MDL.RelayPins[i + j * 8] < NC) // check if relay is enabled { if (bitRead(Rlys, i)) digitalWrite(MDL.RelayPins[i + j * 8], MDL.RelayOnSignal); else digitalWrite(MDL.RelayPins[i + j * 8], !MDL.RelayOnSignal); }