mirror of
https://github.com/lumapu/ahoy.git
synced 2025-06-05 04:01:41 +02:00
* added IP address to serial console on successful connect to station WiFi
* fix: RF24 power setting configuration * added RF24 isChipConnected * added MQTT port configuration * fix offsets for HM400 and HM600 inverters * added warning if configuration was changed without reboot
This commit is contained in:
parent
169bf8c7c8
commit
a9b7fd0599
8 changed files with 92 additions and 53 deletions
|
@ -64,7 +64,7 @@ class HmRadio {
|
|||
~HmRadio() {}
|
||||
|
||||
void setup(BUFFER *ctrl) {
|
||||
//Serial.println("HmRadio::setup, pins: " + String(pinCs) + ", " + String(pinCe) + ", " + String(pinIrq));
|
||||
//DPRINTLN("HmRadio::setup, pins: " + String(pinCs) + ", " + String(pinCe) + ", " + String(pinIrq));
|
||||
pinMode(pinIrq, INPUT_PULLUP);
|
||||
|
||||
mBufCtrl = ctrl;
|
||||
|
@ -84,14 +84,18 @@ class HmRadio {
|
|||
// enable only receiving interrupts
|
||||
mNrf24.maskIRQ(true, true, false);
|
||||
|
||||
Serial.println("RF24 Amp Pwr: RF24_PA_" + String(rf24AmpPower[AmplifierPower]));
|
||||
DPRINTLN("RF24 Amp Pwr: RF24_PA_" + String(rf24AmpPower[AmplifierPower]));
|
||||
mNrf24.setPALevel(AmplifierPower & 0x03);
|
||||
mNrf24.startListening();
|
||||
|
||||
Serial.println("Radio Config:");
|
||||
DPRINTLN("Radio Config:");
|
||||
mNrf24.printPrettyDetails();
|
||||
|
||||
mSendChannel = getDefaultChannel();
|
||||
|
||||
if(!mNrf24.isChipConnected()) {
|
||||
DPRINTLN("WARNING! your NRF24 module can't be reached, check the wiring");
|
||||
}
|
||||
}
|
||||
|
||||
void handleIntr(void) {
|
||||
|
@ -182,6 +186,21 @@ class HmRadio {
|
|||
return valid;
|
||||
}
|
||||
|
||||
void dumpBuf(const char *info, uint8_t buf[], uint8_t len) {
|
||||
DPRINT(String(info));
|
||||
for(uint8_t i = 0; i < len; i++) {
|
||||
if(buf[i] < 10)
|
||||
DPRINT("0");
|
||||
DHEX(buf[i]);
|
||||
DPRINT(" ");
|
||||
}
|
||||
DPRINTLN("");
|
||||
}
|
||||
|
||||
bool isChipConnected(void) {
|
||||
return mNrf24.isChipConnected();
|
||||
}
|
||||
|
||||
uint8_t pinCs;
|
||||
uint8_t pinCe;
|
||||
uint8_t pinIrq;
|
||||
|
@ -190,7 +209,7 @@ class HmRadio {
|
|||
|
||||
private:
|
||||
void sendPacket(uint64_t invId, uint8_t buf[], uint8_t len) {
|
||||
//Serial.println("sent packet: #" + String(mSendCnt));
|
||||
//DPRINTLN("sent packet: #" + String(mSendCnt));
|
||||
//dumpBuf("SEN ", buf, len);
|
||||
|
||||
DISABLE_IRQ;
|
||||
|
@ -202,7 +221,7 @@ class HmRadio {
|
|||
mSendChannel = getDefaultChannel();
|
||||
#endif
|
||||
mNrf24.setChannel(mSendChannel);
|
||||
//Serial.println("CH: " + String(mSendChannel));
|
||||
//DPRINTLN("CH: " + String(mSendChannel));
|
||||
|
||||
mNrf24.openWritingPipe(invId); // TODO: deprecated
|
||||
mNrf24.setCRCLength(RF24_CRC_16);
|
||||
|
@ -237,15 +256,6 @@ class HmRadio {
|
|||
mDtuIdCrc = crc16nrf24(tmp, BIT_CNT(5));
|
||||
}
|
||||
|
||||
void dumpBuf(const char *info, uint8_t buf[], uint8_t len) {
|
||||
Serial.print(String(info));
|
||||
for(uint8_t i = 0; i < len; i++) {
|
||||
Serial.print(buf[i], HEX);
|
||||
Serial.print(" ");
|
||||
}
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
uint8_t mChanOut[4];
|
||||
uint8_t mChanIdx;
|
||||
uint16_t mDtuIdCrc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue