From e2f0226e9fd650e472297252e1ee6a3e63e41cbb Mon Sep 17 00:00:00 2001 From: "Justin E. Mann" Date: Mon, 2 Dec 2024 17:30:46 -0700 Subject: [PATCH] addition varient confi values for other rak4630 variants --- src/detect/ScanI2CTwoWire.cpp | 7 +++++ .../Telemetry/Sensor/RAK12035VBSensor.cpp | 2 +- variants/rak4631/variant.h | 31 ++++++++++--------- variants/rak4631_epaper/variant.h | 24 ++++++++++++++ variants/rak4631_epaper_onrxtx/variant.h | 23 ++++++++++++++ variants/rak4631_eth_gw/variant.h | 23 ++++++++++++++ variants/rak_wismeshtap/variant.h | 25 ++++++++++++++- 7 files changed, 119 insertions(+), 16 deletions(-) diff --git a/src/detect/ScanI2CTwoWire.cpp b/src/detect/ScanI2CTwoWire.cpp index f33005008..aaeea43a2 100644 --- a/src/detect/ScanI2CTwoWire.cpp +++ b/src/detect/ScanI2CTwoWire.cpp @@ -290,6 +290,8 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) // - registry address to interrogate is 0x02, // - expected value is 0x20 // Additional info about registry values for the RAK12035 can be found here [https://github.com/RAKWireless/RAK12035_SoilMoisture/blob/main/RAK12035_SoilMoisture.h] + + #ifdef CAN_HOST_RAK12035VBSOIL registerValue = getRegisterValue(ScanI2CTwoWire::RegisterLocation(addr, 0x02), 1); // get the default address for the device (stored in registry here [0x02]).. should come back as 0x20 LOG_INFO("Checking for RAK12035VB Soil Sensor with registry address 0x02..."); if (registerValue == 0x20) { @@ -301,6 +303,11 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize) type = TCA9535; LOG_INFO("TCA9535 I2C expander found\n"); } + #else + LOG_INFO("Found registry value 0x%x", registerValue); + type = TCA9535; + LOG_INFO("TCA9535 I2C expander found\n"); + #endif break; case MCP9808_ADDR: diff --git a/src/modules/Telemetry/Sensor/RAK12035VBSensor.cpp b/src/modules/Telemetry/Sensor/RAK12035VBSensor.cpp index b2446a48d..56bf83bfc 100644 --- a/src/modules/Telemetry/Sensor/RAK12035VBSensor.cpp +++ b/src/modules/Telemetry/Sensor/RAK12035VBSensor.cpp @@ -80,7 +80,7 @@ bool RAK12035VBSensor::getMetrics(meshtastic_Telemetry *measurement) success = sensor.get_sensor_temperature(&temp); delay(500); - if(success = false){ + if(success == false){ LOG_ERROR("Failed to read sensor data"); return false; } diff --git a/variants/rak4631/variant.h b/variants/rak4631/variant.h index 5e555905e..b1ecc5df4 100644 --- a/variants/rak4631/variant.h +++ b/variants/rak4631/variant.h @@ -135,6 +135,9 @@ static const uint8_t SCK = PIN_SPI_SCK; // #define USE_EINK +// RAK12035VBSOIL Sensor +#define CAN_HOST_RAK12035VBSOIL (1) + // RAKRGB #define HAS_NCP5623 @@ -161,23 +164,23 @@ static const uint8_t SCK = PIN_SPI_SCK; /* * WisBlock Base GPIO definitions */ - #define WB_IO1 (17) // SLOT_A SLOT_B + // #define WB_IO1 (17) // SLOT_A SLOT_B #define WB_IO2 (34) // SLOT_A SLOT_B - #define WB_IO3 (21) // SLOT_C + // #define WB_IO3 (21) // SLOT_C #define WB_IO4 (4) // SLOT_C #define WB_IO5 (9) // SLOT_D - #define WB_IO6 (10) // SLOT_D - #define WB_SW1 (33) // IO_SLOT - #define WB_A0 (5) // IO_SLOT - #define WB_A1 (31) // IO_SLOT - #define WB_I2C1_SDA (13) // SENSOR_SLOT IO_SLOT - #define WB_I2C1_SCL (14) // SENSOR_SLOT IO_SLOT - #define WB_I2C2_SDA (24) // IO_SLOT - #define WB_I2C2_SCL (25) // IO_SLOT - #define WB_SPI_CS (26) // IO_SLOT - #define WB_SPI_CLK (3) // IO_SLOT - #define WB_SPI_MISO (29) // IO_SLOT - #define WB_SPI_MOSI (30) // IO_SLOT + // #define WB_IO6 (10) // SLOT_D + // #define WB_SW1 (33) // IO_SLOT + // #define WB_A0 (5) // IO_SLOT + // #define WB_A1 (31) // IO_SLOT + // #define WB_I2C1_SDA (13) // SENSOR_SLOT IO_SLOT + // #define WB_I2C1_SCL (14) // SENSOR_SLOT IO_SLOT + // #define WB_I2C2_SDA (24) // IO_SLOT + // #define WB_I2C2_SCL (25) // IO_SLOT + // #define WB_SPI_CS (26) // IO_SLOT + // #define WB_SPI_CLK (3) // IO_SLOT + // #define WB_SPI_MISO (29) // IO_SLOT + // #define WB_SPI_MOSI (30) // IO_SLOT /* @note RAK5005-O GPIO mapping to RAK4631 GPIO ports RAK5005-O <-> nRF52840 diff --git a/variants/rak4631_epaper/variant.h b/variants/rak4631_epaper/variant.h index 0bb97498c..61b3d9a54 100644 --- a/variants/rak4631_epaper/variant.h +++ b/variants/rak4631_epaper/variant.h @@ -135,6 +135,9 @@ static const uint8_t SCK = PIN_SPI_SCK; #define USE_EINK +// RAK12035VBSOIL Sensor +#define CAN_HOST_RAK12035VBSOIL (1) + // RAKRGB #define HAS_NCP5623 @@ -158,6 +161,27 @@ static const uint8_t SCK = PIN_SPI_SCK; #define EXTERNAL_FLASH_DEVICES IS25LP080D #define EXTERNAL_FLASH_USE_QSPI +/* + * WisBlock Base GPIO definitions + */ + // #define WB_IO1 (17) // SLOT_A SLOT_B + #define WB_IO2 (34) // SLOT_A SLOT_B + // #define WB_IO3 (21) // SLOT_C + #define WB_IO4 (4) // SLOT_C + #define WB_IO5 (9) // SLOT_D + // #define WB_IO6 (10) // SLOT_D + // #define WB_SW1 (33) // IO_SLOT + // #define WB_A0 (5) // IO_SLOT + // #define WB_A1 (31) // IO_SLOT + // #define WB_I2C1_SDA (13) // SENSOR_SLOT IO_SLOT + // #define WB_I2C1_SCL (14) // SENSOR_SLOT IO_SLOT + // #define WB_I2C2_SDA (24) // IO_SLOT + // #define WB_I2C2_SCL (25) // IO_SLOT + // #define WB_SPI_CS (26) // IO_SLOT + // #define WB_SPI_CLK (3) // IO_SLOT + // #define WB_SPI_MISO (29) // IO_SLOT + // #define WB_SPI_MOSI (30) // IO_SLOT + /* @note RAK5005-O GPIO mapping to RAK4631 GPIO ports RAK5005-O <-> nRF52840 IO1 <-> P0.17 (Arduino GPIO number 17) diff --git a/variants/rak4631_epaper_onrxtx/variant.h b/variants/rak4631_epaper_onrxtx/variant.h index 5888cff33..25c838368 100644 --- a/variants/rak4631_epaper_onrxtx/variant.h +++ b/variants/rak4631_epaper_onrxtx/variant.h @@ -119,6 +119,9 @@ static const uint8_t SCK = PIN_SPI_SCK; #define PIN_EINK_SCLK (0 + 14) // SCL #define PIN_EINK_MOSI (0 + 13) // SDA +// RAK12035VBSOIL Sensor +#define CAN_HOST_RAK12035VBSOIL (1) + // RAKRGB #define HAS_NCP5623 @@ -130,6 +133,26 @@ static const uint8_t SCK = PIN_SPI_SCK; #define PIN_WIRE_SDA (13) #define PIN_WIRE_SCL (14) +/* + * WisBlock Base GPIO definitions + */ + // #define WB_IO1 (17) // SLOT_A SLOT_B + #define WB_IO2 (34) // SLOT_A SLOT_B + // #define WB_IO3 (21) // SLOT_C + #define WB_IO4 (4) // SLOT_C + #define WB_IO5 (9) // SLOT_D + // #define WB_IO6 (10) // SLOT_D + // #define WB_SW1 (33) // IO_SLOT + // #define WB_A0 (5) // IO_SLOT + // #define WB_A1 (31) // IO_SLOT + // #define WB_I2C1_SDA (13) // SENSOR_SLOT IO_SLOT + // #define WB_I2C1_SCL (14) // SENSOR_SLOT IO_SLOT + // #define WB_I2C2_SDA (24) // IO_SLOT + // #define WB_I2C2_SCL (25) // IO_SLOT + // #define WB_SPI_CS (26) // IO_SLOT + // #define WB_SPI_CLK (3) // IO_SLOT + // #define WB_SPI_MISO (29) // IO_SLOT + // #define WB_SPI_MOSI (30) // IO_SLOT /* @note RAK5005-O GPIO mapping to RAK4631 GPIO ports RAK5005-O <-> nRF52840 IO1 <-> P0.17 (Arduino GPIO number 17) diff --git a/variants/rak4631_eth_gw/variant.h b/variants/rak4631_eth_gw/variant.h index bc5541336..304b6f568 100644 --- a/variants/rak4631_eth_gw/variant.h +++ b/variants/rak4631_eth_gw/variant.h @@ -135,6 +135,9 @@ static const uint8_t SCK = PIN_SPI_SCK; // #define USE_EINK +// RAK12035VBSOIL Sensor +#define CAN_HOST_RAK12035VBSOIL (1) + // RAKRGB #define HAS_NCP5623 @@ -158,6 +161,26 @@ static const uint8_t SCK = PIN_SPI_SCK; #define EXTERNAL_FLASH_DEVICES IS25LP080D #define EXTERNAL_FLASH_USE_QSPI +/* + * WisBlock Base GPIO definitions + */ + // #define WB_IO1 (17) // SLOT_A SLOT_B + #define WB_IO2 (34) // SLOT_A SLOT_B + // #define WB_IO3 (21) // SLOT_C + #define WB_IO4 (4) // SLOT_C + #define WB_IO5 (9) // SLOT_D + // #define WB_IO6 (10) // SLOT_D + // #define WB_SW1 (33) // IO_SLOT + // #define WB_A0 (5) // IO_SLOT + // #define WB_A1 (31) // IO_SLOT + // #define WB_I2C1_SDA (13) // SENSOR_SLOT IO_SLOT + // #define WB_I2C1_SCL (14) // SENSOR_SLOT IO_SLOT + // #define WB_I2C2_SDA (24) // IO_SLOT + // #define WB_I2C2_SCL (25) // IO_SLOT + // #define WB_SPI_CS (26) // IO_SLOT + // #define WB_SPI_CLK (3) // IO_SLOT + // #define WB_SPI_MISO (29) // IO_SLOT + // #define WB_SPI_MOSI (30) // IO_SLOT /* @note RAK5005-O GPIO mapping to RAK4631 GPIO ports RAK5005-O <-> nRF52840 IO1 <-> P0.17 (Arduino GPIO number 17) diff --git a/variants/rak_wismeshtap/variant.h b/variants/rak_wismeshtap/variant.h index c21a11ac1..994bf629a 100644 --- a/variants/rak_wismeshtap/variant.h +++ b/variants/rak_wismeshtap/variant.h @@ -133,7 +133,10 @@ static const uint8_t SCK = PIN_SPI_SCK; #define PIN_EINK_SCLK (0 + 3) #define PIN_EINK_MOSI (0 + 30) // also called SDI -// #define USE_EINK +// #def + +// RAK12035VBSOIL Sensor +#define CAN_HOST_RAK12035VBSOIL (1) // RAKRGB #define HAS_NCP5623 @@ -158,6 +161,26 @@ static const uint8_t SCK = PIN_SPI_SCK; #define EXTERNAL_FLASH_DEVICES IS25LP080D #define EXTERNAL_FLASH_USE_QSPI +/* + * WisBlock Base GPIO definitions + */ + // #define WB_IO1 (17) // SLOT_A SLOT_B + #define WB_IO2 (34) // SLOT_A SLOT_B + // #define WB_IO3 (21) // SLOT_C + #define WB_IO4 (4) // SLOT_C + #define WB_IO5 (9) // SLOT_D + // #define WB_IO6 (10) // SLOT_D + // #define WB_SW1 (33) // IO_SLOT + // #define WB_A0 (5) // IO_SLOT + // #define WB_A1 (31) // IO_SLOT + // #define WB_I2C1_SDA (13) // SENSOR_SLOT IO_SLOT + // #define WB_I2C1_SCL (14) // SENSOR_SLOT IO_SLOT + // #define WB_I2C2_SDA (24) // IO_SLOT + // #define WB_I2C2_SCL (25) // IO_SLOT + // #define WB_SPI_CS (26) // IO_SLOT + // #define WB_SPI_CLK (3) // IO_SLOT + // #define WB_SPI_MISO (29) // IO_SLOT + // #define WB_SPI_MOSI (30) // IO_SLOT /* @note RAK5005-O GPIO mapping to RAK4631 GPIO ports RAK5005-O <-> nRF52840 IO1 <-> P0.17 (Arduino GPIO number 17)