Skip to content

Commit

Permalink
define pin not connected
Browse files Browse the repository at this point in the history
  • Loading branch information
SK21 committed Jan 26, 2024
1 parent f8a2588 commit eb6d804
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 18 deletions.
13 changes: 7 additions & 6 deletions Modules/ESP32 Rate/RC_ESP32/RC_ESP32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
#include <ESP2SOTA.h> // 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
Expand All @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -135,8 +137,6 @@ bool PCA9685_found = false;
Adafruit_MCP23X17 MCP;
bool MCP23017_found = false;

int TimedCombo(byte, bool); // function prototype

// analog
struct AnalogConfig
{
Expand All @@ -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()
Expand Down
5 changes: 5 additions & 0 deletions Modules/ESP32 Rate/RC_ESP32/RC_ESP32.vcxproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Modules/ESP32 Rate/RC_ESP32/Relays.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions Modules/Nano/RCnano/RCnano.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion Modules/Nano/RCnano/RCnano.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
<CLanguageStandard>gnu11</CLanguageStandard>
<CAdditionalWarning />
<CppAdditionalWarning />
<ForcedIncludeFiles>$(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)</ForcedIncludeFiles>
<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)</ForcedIncludeFiles>
<UndefineAllPreprocessorDefinitions>true</UndefineAllPreprocessorDefinitions>
<IgnoreStandardIncludePath>true</IgnoreStandardIncludePath>
<PreprocessorDefinitions>_VMICRO_INTELLISENSE;__AVR_atmega328p__;__AVR_ATmega328P__;__AVR_ATmega328p__;F_CPU=16000000L;ARDUINO=108019;ARDUINO_AVR_NANO;ARDUINO_ARCH_AVR;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down
2 changes: 1 addition & 1 deletion Modules/Nano/RCnano/Relays.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions Modules/Nano/RCnano/__vm/Compile.vmps.xml

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Modules/Teensy Rate/RCteensy/RCteensy.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion Modules/Teensy Rate/RCteensy/RCteensy.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@
<CLanguageStandard>gnu11</CLanguageStandard>
<CAdditionalWarning />
<CppAdditionalWarning />
<ForcedIncludeFiles>$(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)</ForcedIncludeFiles>
<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)</ForcedIncludeFiles>
<UndefineAllPreprocessorDefinitions>true</UndefineAllPreprocessorDefinitions>
<IgnoreStandardIncludePath>true</IgnoreStandardIncludePath>
<PreprocessorDefinitions>_VMICRO_INTELLISENSE;__HARDWARE_imxrt1062__;__HARDWARE_IMXRT1062__;__IMXRT1062__;TEENSYDUINO=156;ARDUINO=108019;ARDUINO_TEENSY41;F_CPU=600000000;USB_SERIAL;LAYOUT_US_ENGLISH;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down
2 changes: 1 addition & 1 deletion Modules/Teensy Rate/RCteensy/Relays.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit eb6d804

Please sign in to comment.