Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report couin3 / master #1

Merged
merged 5 commits into from
Sep 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions RFLink/1_Radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
#include "RFLink.h"
#include "1_Radio.h"
#include "4_Display.h"
#ifdef AUTOCONNECT_ENABLED
#include "9_AutoConnect.h"
#else

uint8_t PIN_RF_RX_PMOS = PIN_RF_RX_PMOS_0;
uint8_t PIN_RF_RX_NMOS = PIN_RF_RX_NMOS_0;
uint8_t PIN_RF_RX_VCC = PIN_RF_RX_VCC_0;
Expand All @@ -25,7 +23,6 @@ uint8_t PIN_RF_TX_VCC = PIN_RF_TX_VCC_0;
uint8_t PIN_RF_TX_GND = PIN_RF_TX_GND_0;
uint8_t PIN_RF_TX_NA = PIN_RF_TX_NA_0;
uint8_t PIN_RF_TX_DATA = PIN_RF_TX_DATA_0;
#endif //AUTOCONNECT_ENABLED

Radio_State current_State = Radio_NA;

Expand All @@ -45,7 +42,12 @@ void set_Radio_mode(Radio_State new_State)
case Radio_OFF:
PIN_RF_RX_DATA = NOT_A_PIN;
PIN_RF_TX_DATA = NOT_A_PIN;
radio.reset();
radio.initialize();
radio.setFrequency(433920000);
Serial.print("Freq = ");
Serial.println(radio.getFrequency());
//Serial.print("Temp = "); Serial.println(radio.readTemperature());
radio.setHighPower(true); // for RFM69HW
// radio.sleep();
break;
Expand Down
2 changes: 1 addition & 1 deletion RFLink/1_Radio.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ void set_Radio_mode(Radio_State new_state);
#if (defined(ESP8266) || defined(ESP32))
void show_Radio_Pin();
#endif // ESP8266 || ESP32
#endif // Radio_h
#endif // Radio_h
20 changes: 10 additions & 10 deletions RFLink/2_Signal.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

#include <Arduino.h>

#define RAW_BUFFER_SIZE 292 // 292 // Maximum number of pulses that is received in one go.
#define MIN_RAW_PULSES 50 // 50 // Minimal number of bits that need to have been received before we spend CPU time on decoding the signal.
#define RAWSIGNAL_SAMPLE_RATE 32 // 32 // =8 bits. Sample width / resolution in uSec for raw RF pulses.
#define SIGNAL_SEEK_TIMEOUT_MS 25 // 25 // After this time in mSec, RF signal will be considered absent.
#define SIGNAL_MIN_PREAMBLE_US 400 // 400 // After this time in uSec, a RF signal will be considered to have started.
#define MIN_PULSE_LENGTH_US 100 // 250 // Pulses shorter than this value in uSec. will be seen as garbage and not taken as actual pulses.
#define SIGNAL_END_TIMEOUT_US 5000 // 5000 // After this time in uSec, the RF signal will be considered to have stopped.
#define SIGNAL_REPEAT_TIME_MS 250 // 500 // Time in mSec. in which the same RF signal should not be accepted again. Filters out retransmits.
#define SCAN_HIGH_TIME_MS 50 // 50 // time interval in ms. fast processing for background tasks
#define RAW_BUFFER_SIZE 292 // 292 // Maximum number of pulses that is received in one go.
#define MIN_RAW_PULSES 50 // 50 // Minimal number of bits that need to have been received before we spend CPU time on decoding the signal.
#define RAWSIGNAL_SAMPLE_RATE 32 // 32 // =8 bits. Sample width / resolution in uSec for raw RF pulses.
#define SIGNAL_SEEK_TIMEOUT_MS 25 // 25 // After this time in mSec, RF signal will be considered absent.
#define SIGNAL_MIN_PREAMBLE_US 400 // 400 // After this time in uSec, a RF signal will be considered to have started.
#define MIN_PULSE_LENGTH_US 100 // 250 // Pulses shorter than this value in uSec. will be seen as garbage and not taken as actual pulses.
#define SIGNAL_END_TIMEOUT_US 5000 // 5000 // After this time in uSec, the RF signal will be considered to have stopped.
#define SIGNAL_REPEAT_TIME_MS 250 // 500 // Time in mSec. in which the same RF signal should not be accepted again. Filters out retransmits.
#define SCAN_HIGH_TIME_MS 50 // 50 // time interval in ms. fast processing for background tasks

struct RawSignalStruct // Raw signal variabelen places in a struct
{
Expand All @@ -45,4 +45,4 @@ boolean ScanEvent(void);

void AC_Send(unsigned long data, byte cmd);

#endif
#endif
32 changes: 1 addition & 31 deletions RFLink/3_Serial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,36 +49,6 @@ boolean CheckMQTT(byte *byte_in)
return false;
}

#ifdef AUTOCONNECT_ENABLED
boolean CheckWeb(String &String_in)
{
if (!String_in.isEmpty())
{
String_in.trim();
char char_in[INPUT_COMMAND_SIZE];
String_in.toCharArray(char_in, String_in.length() + 1);
char_in[String_in.length() + 1] = 0;

if (CopySerial(char_in))
{
#ifdef SERIAL_ENABLED
Serial.flush();
Serial.print(F("Message arrived [Web] "));
Serial.println(InputBuffer_Serial);
#endif
if (CheckCmd())
{
String_in.clear();
return true;
}
}
String_in.clear();
return false;
}
return false;
}
#endif // AUTOCONNECT_ENABLED

boolean CopySerial(char *src)
{
return (strncpy(InputBuffer_Serial, src, INPUT_COMMAND_SIZE - 2));
Expand Down Expand Up @@ -262,4 +232,4 @@ boolean CheckCmd()
return true;
}

/*********************************************************************************************/
/*********************************************************************************************/
5 changes: 1 addition & 4 deletions RFLink/3_Serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,4 @@ extern char InputBuffer_Serial[INPUT_COMMAND_SIZE];

boolean CheckSerial();
boolean CheckMQTT(byte *);
#ifdef AUTOCONNECT_ENABLED
boolean CheckWeb(String &);
#endif // AUTOCONNECT_ENABLED
#endif
#endif
2 changes: 1 addition & 1 deletion RFLink/4_Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,4 +658,4 @@ String GPIO2String(uint8_t uGPIO)
else
return "NOT_A_PIN";
}
#endif // ESP32
#endif // ESP32
Loading