mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-14 01:16:37 +02:00
0.8.24
* fix NRF communication for opendtufusion ethernet variant
This commit is contained in:
parent
222bf0e54a
commit
f191c036bb
8 changed files with 29 additions and 17 deletions
|
@ -31,5 +31,4 @@ if env['PIOENV'][:22] != "opendtufusion-ethernet":
|
||||||
|
|
||||||
if env['PIOENV'][:13] == "opendtufusion":
|
if env['PIOENV'][:13] == "opendtufusion":
|
||||||
applyPatch("GxEPD2", "../patches/GxEPD2_SW_SPI.patch")
|
applyPatch("GxEPD2", "../patches/GxEPD2_SW_SPI.patch")
|
||||||
if env['PIOENV'][:22] == "opendtufusion-ethernet":
|
|
||||||
applyPatch("RF24", "../patches/RF24_Hal.patch")
|
applyPatch("RF24", "../patches/RF24_Hal.patch")
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
# Development Changes
|
# Development Changes
|
||||||
|
|
||||||
|
## 0.8.24 - 2023-12-16
|
||||||
|
* fix NRF communication for opendtufusion ethernet variant
|
||||||
|
|
||||||
## 0.8.23 - 2023-12-14
|
## 0.8.23 - 2023-12-14
|
||||||
* heuristics fix #1269 #1270
|
* heuristics fix #1269 #1270
|
||||||
* moved `sendInterval` in settings, **important:** *will be reseted to 15s after update to this version*
|
* moved `sendInterval` in settings, **important:** *will be reseted to 15s after update to this version*
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 8
|
#define VERSION_MINOR 8
|
||||||
#define VERSION_PATCH 23
|
#define VERSION_PATCH 24
|
||||||
|
|
||||||
//-------------------------------------
|
//-------------------------------------
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
@ -31,6 +31,7 @@ class CommQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t getFillState(void) {
|
uint8_t getFillState(void) {
|
||||||
|
DPRINTLN(DBG_INFO, "wr: " + String(mWrPtr) + ", rd: " + String(mRdPtr));
|
||||||
return abs(mRdPtr - mWrPtr);
|
return abs(mRdPtr - mWrPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
#include "radio.h"
|
#include "radio.h"
|
||||||
#include "../config/config.h"
|
#include "../config/config.h"
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(ETHERNET)
|
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(SPI_HAL)
|
||||||
#include "nrfHal.h"
|
#include "nrfHal.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -35,8 +35,8 @@ class HmRadio : public Radio {
|
||||||
HmRadio() {
|
HmRadio() {
|
||||||
mDtuSn = DTU_SN;
|
mDtuSn = DTU_SN;
|
||||||
mIrqRcvd = false;
|
mIrqRcvd = false;
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(ETHERNET)
|
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(SPI_HAL)
|
||||||
mNrf24.reset(new RF24());
|
//mNrf24.reset(new RF24());
|
||||||
#else
|
#else
|
||||||
mNrf24.reset(new RF24(CE_PIN, CS_PIN, SPI_SPEED));
|
mNrf24.reset(new RF24(CE_PIN, CS_PIN, SPI_SPEED));
|
||||||
#endif
|
#endif
|
||||||
|
@ -56,8 +56,8 @@ class HmRadio : public Radio {
|
||||||
DTU_RADIO_ID = ((uint64_t)(((mDtuSn >> 24) & 0xFF) | ((mDtuSn >> 8) & 0xFF00) | ((mDtuSn << 8) & 0xFF0000) | ((mDtuSn << 24) & 0xFF000000)) << 8) | 0x01;
|
DTU_RADIO_ID = ((uint64_t)(((mDtuSn >> 24) & 0xFF) | ((mDtuSn >> 8) & 0xFF00) | ((mDtuSn << 8) & 0xFF0000) | ((mDtuSn << 24) & 0xFF000000)) << 8) | 0x01;
|
||||||
|
|
||||||
#ifdef ESP32
|
#ifdef ESP32
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(ETHERNET)
|
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(SPI_HAL)
|
||||||
mNrfHal.init(mosi, miso, sclk, cs, ce);
|
mNrfHal.init(mosi, miso, sclk, cs, ce, SPI_SPEED);
|
||||||
mNrf24.reset(new RF24(&mNrfHal));
|
mNrf24.reset(new RF24(&mNrfHal));
|
||||||
#else
|
#else
|
||||||
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
|
#if CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S2 || CONFIG_IDF_TARGET_ESP32S3
|
||||||
|
@ -73,7 +73,7 @@ class HmRadio : public Radio {
|
||||||
mSpi->begin();
|
mSpi->begin();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(ETHERNET)
|
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(SPI_HAL)
|
||||||
mNrf24->begin();
|
mNrf24->begin();
|
||||||
#else
|
#else
|
||||||
mNrf24->begin(mSpi.get(), ce, cs);
|
mNrf24->begin(mSpi.get(), ce, cs);
|
||||||
|
@ -133,14 +133,12 @@ class HmRadio : public Radio {
|
||||||
yield();
|
yield();
|
||||||
}
|
}
|
||||||
// switch to next RX channel
|
// switch to next RX channel
|
||||||
if(++mRxChIdx >= RF_CHANNELS)
|
mRxChIdx = (mRxChIdx + 1) % RF_CHANNELS;
|
||||||
mRxChIdx = 0;
|
|
||||||
mNrf24->setChannel(mRfChLst[mRxChIdx]);
|
mNrf24->setChannel(mRfChLst[mRxChIdx]);
|
||||||
startMicros = micros();
|
startMicros = micros();
|
||||||
}
|
}
|
||||||
// not finished but time is over
|
// not finished but time is over
|
||||||
if(++mRxChIdx >= RF_CHANNELS)
|
mRxChIdx = (mRxChIdx + 1) % RF_CHANNELS;
|
||||||
mRxChIdx = 0;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -344,7 +342,7 @@ class HmRadio : public Radio {
|
||||||
|
|
||||||
std::unique_ptr<SPIClass> mSpi;
|
std::unique_ptr<SPIClass> mSpi;
|
||||||
std::unique_ptr<RF24> mNrf24;
|
std::unique_ptr<RF24> mNrf24;
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(ETHERNET)
|
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(SPI_HAL)
|
||||||
nrfHal mNrfHal;
|
nrfHal mNrfHal;
|
||||||
#endif
|
#endif
|
||||||
Inverter<> *mLastIv = NULL;
|
Inverter<> *mLastIv = NULL;
|
||||||
|
|
|
@ -118,7 +118,7 @@ class nrfHal: public RF24_hal, public SpiPatcherHandle {
|
||||||
uint8_t write(uint8_t cmd, const uint8_t* buf, uint8_t data_len, uint8_t blank_len) override {
|
uint8_t write(uint8_t cmd, const uint8_t* buf, uint8_t data_len, uint8_t blank_len) override {
|
||||||
uint8_t data[NRF_MAX_TRANSFER_SZ];
|
uint8_t data[NRF_MAX_TRANSFER_SZ];
|
||||||
data[0] = cmd;
|
data[0] = cmd;
|
||||||
memset(data, 0, NRF_MAX_TRANSFER_SZ);
|
memset(&data[1], 0, (NRF_MAX_TRANSFER_SZ-1));
|
||||||
std::copy(&buf[0], &buf[data_len], &data[1]);
|
std::copy(&buf[0], &buf[data_len], &data[1]);
|
||||||
|
|
||||||
request_spi();
|
request_spi();
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#ifndef __CMT2300A_H__
|
#ifndef __CMT2300A_H__
|
||||||
#define __CMT2300A_H__
|
#define __CMT2300A_H__
|
||||||
|
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(ETHERNET)
|
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(SPI_HAL)
|
||||||
#include "cmtHal.h"
|
#include "cmtHal.h"
|
||||||
#else
|
#else
|
||||||
#include "esp32_3wSpi.h"
|
#include "esp32_3wSpi.h"
|
||||||
|
@ -480,7 +480,7 @@ class Cmt2300a {
|
||||||
return mSpi.readReg(CMT2300A_CUS_MODE_STA) & CMT2300A_MASK_CHIP_MODE_STA;
|
return mSpi.readReg(CMT2300A_CUS_MODE_STA) & CMT2300A_MASK_CHIP_MODE_STA;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(ETHERNET)
|
#if defined(CONFIG_IDF_TARGET_ESP32S3) && defined(SPI_HAL)
|
||||||
cmtHal mSpi;
|
cmtHal mSpi;
|
||||||
#else
|
#else
|
||||||
esp32_3wSpi mSpi;
|
esp32_3wSpi mSpi;
|
||||||
|
|
|
@ -162,6 +162,7 @@ lib_deps =
|
||||||
upload_protocol = esp-builtin
|
upload_protocol = esp-builtin
|
||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DETHERNET
|
-DETHERNET
|
||||||
|
-DSPI_HAL
|
||||||
-DUSE_HSPI_FOR_EPD
|
-DUSE_HSPI_FOR_EPD
|
||||||
-DDEF_ETH_CS_PIN=42
|
-DDEF_ETH_CS_PIN=42
|
||||||
-DDEF_ETH_SCK_PIN=39
|
-DDEF_ETH_SCK_PIN=39
|
||||||
|
@ -184,13 +185,22 @@ build_flags = ${env.build_flags}
|
||||||
-DDEF_LED1=17
|
-DDEF_LED1=17
|
||||||
-DLED_ACTIVE_HIGH
|
-DLED_ACTIVE_HIGH
|
||||||
-DARDUINO_USB_MODE=1
|
-DARDUINO_USB_MODE=1
|
||||||
#-DARDUINO_USB_CDC_ON_BOOT=1
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
monitor_filters =
|
monitor_filters =
|
||||||
esp32_exception_decoder, colorize
|
esp32_exception_decoder, colorize
|
||||||
|
|
||||||
[env:opendtufusion-dev]
|
[env:opendtufusion-dev]
|
||||||
platform = espressif32@6.4.0
|
platform = espressif32@6.4.0
|
||||||
board = esp32-s3-devkitc-1
|
board = esp32-s3-devkitc-1
|
||||||
|
lib_deps =
|
||||||
|
https://github.com/yubox-node-org/ESPAsyncWebServer
|
||||||
|
https://github.com/nrf24/RF24 @ ^1.4.8
|
||||||
|
paulstoffregen/Time @ ^1.6.1
|
||||||
|
https://github.com/bertmelis/espMqttClient#v1.5.0
|
||||||
|
bblanchon/ArduinoJson @ ^6.21.3
|
||||||
|
https://github.com/JChristensen/Timezone @ ^1.2.4
|
||||||
|
olikraus/U8g2 @ ^2.35.7
|
||||||
|
https://github.com/zinggjm/GxEPD2 @ ^1.5.2
|
||||||
upload_protocol = esp-builtin
|
upload_protocol = esp-builtin
|
||||||
build_flags = ${env.build_flags}
|
build_flags = ${env.build_flags}
|
||||||
-DDEF_NRF_CS_PIN=37
|
-DDEF_NRF_CS_PIN=37
|
||||||
|
@ -209,5 +219,6 @@ build_flags = ${env.build_flags}
|
||||||
-DLED_ACTIVE_HIGH
|
-DLED_ACTIVE_HIGH
|
||||||
-DARDUINO_USB_MODE=1
|
-DARDUINO_USB_MODE=1
|
||||||
-DARDUINO_USB_CDC_ON_BOOT=1
|
-DARDUINO_USB_CDC_ON_BOOT=1
|
||||||
|
-DSPI_HAL
|
||||||
monitor_filters =
|
monitor_filters =
|
||||||
esp32_exception_decoder, colorize
|
esp32_exception_decoder, colorize
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue