From 4487c024aaa8b35e2a77b0237f53470fbce6222c Mon Sep 17 00:00:00 2001 From: HomeAutoUser Date: Wed, 23 Jun 2021 22:08:36 +0200 Subject: [PATCH] Fix - GFSK & nano crash (#211) * dev-r3.5_xFSK Bugfix GFSK - Allows other modulations than ASK / OOK and 2-FSK to be received. * fix nano328 send crash - revised PROGVERS - pins excluded to avoid crash - revised comment & changed pins - revised code PullUp loop https://github.com/RFD-FHEM/SIGNALDuino/pull/211#issuecomment-864606932 --- src/cc1101.cpp | 11 ++++++----- src/compile_config.h | 2 +- src/signalduino.h | 27 ++++++++++++++++++++++++++- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/cc1101.cpp b/src/cc1101.cpp index 0f926f95..9ac86814 100644 --- a/src/cc1101.cpp +++ b/src/cc1101.cpp @@ -5,7 +5,7 @@ #endif #define ccMaxBuf 64 // for cc1101 FIFO, variable is better to revised -uint8_t cc1101::ccmode = 3; // MDMCFG2–Modem Configuration Bit 6:4 +uint8_t cc1101::ccmode = 3; // MDMCFG2–Modem Configuration Bit 6:4 default ASK/OOK uint8_t cc1101::revision = 0x01; uint8_t ccBuf[ccMaxBuf]; // for cc1101 FIFO, if Circuit board for more cc110x -> ccBuf expand ( ccBuf[radionr][ccMaxBuf] ) extern volatile bool blinkLED; @@ -247,7 +247,7 @@ void cc1101::writeCCreg(uint8_t reg, uint8_t var) { // write CC1101 register writeReg(reg - EE_CC1101_CFG, var); if (reg - EE_CC1101_CFG == 18) { - ccmode = ( var & 0x70 ) >> 4; // for STM32 - read modulation direct from 0x12 MDMCFG2 + ccmode = ( var & 0x70 ) >> 4; // read modulation direct from 0x12 MDMCFG2 } /* @@ -596,9 +596,9 @@ void cc1101::getRxFifo(uint16_t Boffs) { // xFSK fifoBytes = ccMaxBuf; } dup = readRXFIFO(fifoBytes); - if (cc1101::ccmode != 2 || dup == false) { + if (cc1101::ccmode != 2 || dup == false) { // Ralf9: 2 - FIFO ohne dup - if (cc1101::ccmode != 9) { + if (cc1101::ccmode != 9) { // Ralf9: 9 - FIFO mit Debug Ausgaben MSG_PRINT(char(MSG_START)); // SDC_WRITE not work in this scope MSG_PRINT(F("MN;D=")); } @@ -656,7 +656,8 @@ void cc1101::getRxFifo(uint16_t Boffs) { // xFSK * */ - if (marcstate == 17 || cc1101::ccmode == 0) { // RXoverflow oder LaCrosse? + if (marcstate == 17 || cc1101::ccmode != 3) { // RXoverflow oder nicht ASK/OOK +// if (marcstate == 17 || cc1101::ccmode == 0) { // RXoverflow oder LaCrosse? if (cc1101::flushrx()) { // Flush the RX FIFO buffer cc1101::setReceiveMode(); } diff --git a/src/compile_config.h b/src/compile_config.h index 7cace992..3d246bad 100644 --- a/src/compile_config.h +++ b/src/compile_config.h @@ -45,7 +45,7 @@ */ -#define PROGVERS "3.5.0-dev+20210420" +#define PROGVERS "3.5.0-dev+20210623" #ifdef OTHER_BOARD_WITH_CC1101 #define CMP_CC1101 diff --git a/src/signalduino.h b/src/signalduino.h index 374856a7..f2c3d953 100644 --- a/src/signalduino.h +++ b/src/signalduino.h @@ -96,9 +96,34 @@ void setup() { ; // wait for serial port to connect. Needed for native USB } - for (uint8_t i=2;i<13;i++) { + // defined states - pullup on for unused pins + // start behind RX / TX Pin´s --> all hardware used for system serial 0 & 1 + // not radino (other boards) --> end on Pin 23 + // radino --> end on Pin 29 (CCM_radino_CC1101.pdf | sources In-Circuit -> pins_arduino.h) + for (uint8_t i=2 ; i<=29;i++) { + #ifndef ARDUINO_RADINOCC1101 + if (i>23) break; + #endif + + if (i==LED_BUILTIN) continue; + if (i==PIN_LED) continue; + if (i==PIN_RECEIVE) continue; + if (i==PIN_SEND) continue; + + #ifdef CMP_CC1101 + if (i==MOSI || i==MISO || i==SCK || i==SS) continue; + #endif + + #if defined(ARDUINO_RADINOCC1101) || defined(ARDUINO_ATMEGA328P_MINICUL) + if (i==PIN_MARK433) continue; + + #ifdef ARDUINO_RADINOCC1101 + if (i==8 || i==LED_BUILTIN_RX || i==LED_BUILTIN_TX) continue; // special pin ´s --> ...\packages\In-Circuit\hardware\avr\1.0.0\variants\ictmicro --> pins_arduino.h + #endif + #endif pinAsInputPullUp(i); } + //delay(2000); pinAsInput(PIN_RECEIVE); pinAsOutput(PIN_LED);