Skip to content

Commit

Permalink
Merge pull request #41 from obones/FixWarnings
Browse files Browse the repository at this point in the history
Fix warnings
  • Loading branch information
cpainchaud authored Jul 19, 2021
2 parents 87e5dff + 0e81bd1 commit a46dbe9
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 44 deletions.
6 changes: 3 additions & 3 deletions RFLink/11_Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ namespace RFLink

if (item->typeIsChar())
{
if (!remoteVariant.is<char *>())
if (!remoteVariant.is<const char *>())
{
message += F("section '");
message += kv.key().c_str();
Expand Down Expand Up @@ -543,9 +543,9 @@ namespace RFLink

if (this->typeIsChar())
{
if (!value.is<char *>())
if (!value.is<const char *>())
{
value.set((char *)this->getCharDefaultValue());
value.set((const char *)this->getCharDefaultValue());
return true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions RFLink/12_Portal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ namespace RFLink { namespace Portal {
return;
}

if(!url.is<char *>()) {
if(!url.is<const char *>()) {
request->send(400, F("text/plain"), F("malformed request data"));
return;
}

const char *url_str = url.as<char *>();
const char *url_str = url.as<const char *>();
int url_length = strlen(url_str);

if(url_length < 7) {
Expand Down
14 changes: 0 additions & 14 deletions RFLink/1_Radio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ namespace RFLink { namespace Radio {

void refreshParametersFromConfig() {
States savedState = current_State;
bool pinsHaveChanged = false;
HardwareType newHardwareId = hardware;

//yield();
Expand Down Expand Up @@ -185,56 +184,48 @@ namespace RFLink { namespace Radio {
item = Config::findConfigItem(json_name_rx_data, Config::SectionId::Radio_id);
if( pins::RX_DATA != item->getLongIntValue() ) {
changesDetected = true;
pinsHaveChanged = true;
pins::RX_DATA = item->getLongIntValue();
}

item = Config::findConfigItem(json_name_rx_vcc, Config::SectionId::Radio_id);
if( pins::RX_VCC != item->getLongIntValue() ) {
changesDetected = true;
pinsHaveChanged = true;
pins::RX_VCC = item->getLongIntValue();
}

item = Config::findConfigItem(json_name_rx_nmos, Config::SectionId::Radio_id);
if( pins::RX_NMOS != item->getLongIntValue() ) {
changesDetected = true;
pinsHaveChanged = true;
pins::RX_NMOS = item->getLongIntValue();
}

item = Config::findConfigItem(json_name_rx_pmos, Config::SectionId::Radio_id);
if( pins::RX_PMOS != item->getLongIntValue() ) {
changesDetected = true;
pinsHaveChanged = true;
pins::RX_PMOS = item->getLongIntValue();
}

item = Config::findConfigItem(json_name_rx_gnd, Config::SectionId::Radio_id);
if( pins::RX_GND != item->getLongIntValue() ) {
changesDetected = true;
pinsHaveChanged = true;
pins::RX_GND = item->getLongIntValue();
}

item = Config::findConfigItem(json_name_rx_na, Config::SectionId::Radio_id);
if( pins::RX_NA != item->getLongIntValue() ) {
changesDetected = true;
pinsHaveChanged = true;
pins::RX_NA = item->getLongIntValue();
}

item = Config::findConfigItem(json_name_rx_reset, Config::SectionId::Radio_id);
if( pins::RX_RESET != item->getLongIntValue() ) {
changesDetected = true;
pinsHaveChanged = true;
pins::RX_RESET = item->getLongIntValue();
}

item = Config::findConfigItem(json_name_rx_cs, Config::SectionId::Radio_id);
if( pins::RX_CS != item->getLongIntValue() ) {
changesDetected = true;
pinsHaveChanged = true;
pins::RX_CS = item->getLongIntValue();
}

Expand All @@ -243,35 +234,30 @@ namespace RFLink { namespace Radio {
item = Config::findConfigItem(json_name_tx_data, Config::SectionId::Radio_id);
if( pins::TX_DATA != item->getLongIntValue() ) {
changesDetected = true;
pinsHaveChanged = true;
pins::TX_DATA = item->getLongIntValue();
}

item = Config::findConfigItem(json_name_tx_vcc, Config::SectionId::Radio_id);
if( pins::TX_VCC != item->getLongIntValue() ) {
changesDetected = true;
pinsHaveChanged = true;
pins::TX_VCC = item->getLongIntValue();
}

item = Config::findConfigItem(json_name_tx_nmos, Config::SectionId::Radio_id);
if( pins::TX_NMOS != item->getLongIntValue() ) {
changesDetected = true;
pinsHaveChanged = true;
pins::TX_NMOS = item->getLongIntValue();
}

item = Config::findConfigItem(json_name_tx_pmos, Config::SectionId::Radio_id);
if( pins::TX_PMOS != item->getLongIntValue() ) {
changesDetected = true;
pinsHaveChanged = true;
pins::TX_PMOS = item->getLongIntValue();
}

item = Config::findConfigItem(json_name_tx_gnd, Config::SectionId::Radio_id);
if( pins::TX_GND != item->getLongIntValue() ) {
changesDetected = true;
pinsHaveChanged = true;
pins::TX_GND = item->getLongIntValue();
}

Expand Down
23 changes: 12 additions & 11 deletions RFLink/2_Signal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,14 @@ namespace RFLink
unsigned long averagedGapsLength;
unsigned long dynamicGapEnd_us;

float longPulseRssiReference; // with high gains, output can remain high forever so RSSI must be checked from time to time
int longPulseRssiTimer;
float longPulseRssiReference = 0.0; // with high gains, output can remain high forever so RSSI must be checked from time to time
int longPulseRssiTimer = 0;
// *********************************************************************************

#ifdef RFLINK_SIGNAL_RSSI_DEBUG
#define STORE_PULSE (RawSignal.Pulses[RawCodeLength++] = PulseLength_us / params::sample_rate; RawSignal.Rssis[RawCodeLength] = Radio::getCurrentRssi();)
#else
#undef STORE_PULSE
#define STORE_PULSE (RawSignal.Pulses[RawCodeLength++] = PulseLength_us / params::sample_rate)
#endif

Expand Down Expand Up @@ -376,7 +377,7 @@ namespace RFLink

if(runtime::verboseSignalFetchLoop) {
sprintf_P(printBuf,
PSTR("%.4X LONG Pulse EARLY reset because of RSSI gap within it (refRssi=%.0f newRssi=%.0f length=%lu pos=%u)"),
PSTR("%.4lX LONG Pulse EARLY reset because of RSSI gap within it (refRssi=%.0f newRssi=%.0f length=%lu pos=%u)"),
RawSignal.Time,
longPulseRssiReference,
newRssi,
Expand Down Expand Up @@ -408,7 +409,7 @@ namespace RFLink
SWITCH_TOGGLE;
if (!CHECK_TIMEOUT){
if(runtime::verboseSignalFetchLoop) {
sprintf_P(printBuf, PSTR("%.4X Early signal dropped because of seek_timeout (pulseLen=%lu)"),
sprintf_P(printBuf, PSTR("%.4lX Early signal dropped because of seek_timeout (pulseLen=%lu)"),
RawSignal.Time,
PulseLength_us);
RFLink::sendRawPrint(printBuf, true);
Expand Down Expand Up @@ -460,7 +461,7 @@ namespace RFLink
if (longPulseRssiTimer > 100 && longPulseRssiReference + 3 < newRssi) {
if(runtime::verboseSignalFetchLoop) {
sprintf_P(printBuf,
PSTR("%.4X LONG Pulse resets signal because of RSSI gap within it (refRssi=%.0f newRssi=%.0f length=%lu toggle=%i pos=%u)"),
PSTR("%.4lX LONG Pulse resets signal because of RSSI gap within it (refRssi=%.0f newRssi=%.0f length=%lu toggle=%i pos=%u)"),
RawSignal.Time,
longPulseRssiReference,
newRssi,
Expand Down Expand Up @@ -498,7 +499,7 @@ namespace RFLink
if( ((unsigned long)RawSignal.Pulses[RawCodeLength-1])*(unsigned long)params::sample_rate >= ((unsigned long)averagedGapsLength)*(unsigned long)150/(unsigned long)100 ) {
// if previous Gap is 1.5x the average of Gaps we will try to decode still!
if(runtime::verboseSignalFetchLoop) {
sprintf_P(printBuf, PSTR("%.4X attempted noise filter"), RawSignal.Time);
sprintf_P(printBuf, PSTR("%.4lX attempted noise filter"), RawSignal.Time);
RFLink::sendRawPrint(printBuf, true);
}
RawSignal.endReason = EndReasons::AttemptedNoiseFilter;
Expand All @@ -507,7 +508,7 @@ namespace RFLink
}
}
if(runtime::verboseSignalFetchLoop) {
sprintf_P(printBuf, PSTR("%.4X Dropped signal due to short pulse (RawCodeLength=%u, pulseLen=%lu)"), RawSignal.Time, RawCodeLength, PulseLength_us);
sprintf_P(printBuf, PSTR("%.4lX Dropped signal due to short pulse (RawCodeLength=%u, pulseLen=%lu)"), RawSignal.Time, RawCodeLength, PulseLength_us);
RFLink::sendRawPrint(printBuf, true);
}
return false; // it seems to be noise so we're out !
Expand All @@ -518,7 +519,7 @@ namespace RFLink
STORE_PULSE;
if(runtime::verboseSignalFetchLoop) {
sprintf_P(printBuf,
PSTR("%.4X Ended signal because of dynamic gap length reached (pulse=%lu dynamicGap=%lu pos=%i)"),
PSTR("%.4lX Ended signal because of dynamic gap length reached (pulse=%lu dynamicGap=%lu pos=%i)"),
RawSignal.Time,
PulseLength_us, dynamicGapEnd_us, (int) RawCodeLength);
RFLink::sendRawPrint(printBuf, true);
Expand All @@ -534,7 +535,7 @@ namespace RFLink
STORE_PULSE;

if(runtime::verboseSignalFetchLoop) {
sprintf_P(printBuf, PSTR("%.4X Signal ended because of signal_end_timeout (toggle=%i pos=%i)"),
sprintf_P(printBuf, PSTR("%.4lX Signal ended because of signal_end_timeout (toggle=%i pos=%i)"),
RawSignal.Time,
(int) Toggle,
(int) RawCodeLength);
Expand Down Expand Up @@ -579,7 +580,7 @@ namespace RFLink
else
{
if(runtime::verboseSignalFetchLoop) {
sprintf_P(printBuf, PSTR("%.4X Dropped signal because it's too short (RawCodeLength=%u)"), RawSignal.Time, RawCodeLength);
sprintf_P(printBuf, PSTR("%.4lX Dropped signal because it's too short (RawCodeLength=%u)"), RawSignal.Time, RawCodeLength);
RFLink::sendRawPrint(printBuf, true);
}
RawSignal.Number = 0;
Expand Down Expand Up @@ -617,7 +618,7 @@ namespace RFLink
{ // Check all plugins to see which plugin can handle the received signal.
counters::successfullyDecodedSignalsCount++;
RepeatingTimer = millis() + params::signal_repeat_time;
auto responseLength = strlen(pbuffer);
//auto responseLength = strlen(pbuffer);
//if(responseLength>1)
// sprintf(&pbuffer[responseLength-2], "RSSI=%i;\r\n", (int)RawSignal.rssi);
return true;
Expand Down
14 changes: 7 additions & 7 deletions RFLink/Plugins/Plugin_001.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,18 +90,18 @@
boolean Plugin_001(byte function, const char *string)
{
// byte HEconversiontype = 1; // 0=No conversion, 1=conversion to Elro 58 pulse protocol (same as FA500R Method 1)
const long PULSE500 = PULSE500_D / RawSignal.Multiply;
//const long PULSE500 = PULSE500_D / RawSignal.Multiply;
const long PULSE1100 = PULSE1100_D / RawSignal.Multiply;
const long PULSE1600 = PULSE1600_D / RawSignal.Multiply;
const long PULSE2000 = PULSE2000_D / RawSignal.Multiply;
const long PULSE4000 = PULSE4000_D / RawSignal.Multiply;
const long PULSE4200 = PULSE4200_D / RawSignal.Multiply;
//const long PULSE1600 = PULSE1600_D / RawSignal.Multiply;
//const long PULSE2000 = PULSE2000_D / RawSignal.Multiply;
//const long PULSE4000 = PULSE4000_D / RawSignal.Multiply;
//const long PULSE4200 = PULSE4200_D / RawSignal.Multiply;
const long PULSE3300 = PULSE3300_D / RawSignal.Multiply;
const long PULSE2500 = PULSE2500_D / RawSignal.Multiply;
const long PULSE3000 = PULSE3000_D / RawSignal.Multiply;
const long PULSE5000 = PULSE5000_D / RawSignal.Multiply;
const long PULSE6000 = PULSE6000_D / RawSignal.Multiply;
const long PULSE6500 = PULSE6500_D / RawSignal.Multiply;
//const long PULSE6000 = PULSE6000_D / RawSignal.Multiply;
//const long PULSE6500 = PULSE6500_D / RawSignal.Multiply;

int i, j;
// ==========================================================================
Expand Down
4 changes: 0 additions & 4 deletions RFLink/Plugins/Plugin_010.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ boolean Plugin_010(byte function, const char *string)

const long RGB_PULSE_STHI = RGB_PULSE_STHI_D / RawSignal.Multiply;
const long RGB_PULSE_STLO = RGB_PULSE_STLO_D / RawSignal.Multiply;
const long RGB_PULSE_HIHI = RGB_PULSE_HIHI_D / RawSignal.Multiply;
const long RGB_PULSE_HILO = RGB_PULSE_HILO_D / RawSignal.Multiply;
const long RGB_PULSE_LOHI = RGB_PULSE_LOHI_D / RawSignal.Multiply;
const long RGB_PULSE_LOLO = RGB_PULSE_LOLO_D / RawSignal.Multiply;

unsigned long bitstream = 0L; // holds first 32 bits

Expand Down
4 changes: 1 addition & 3 deletions RFLink/Plugins/Plugin_037.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
boolean Plugin_037(byte function, const char *string)
{
const long ACURITE_MIDHI = ACURITE_MIDHI_D / RawSignal.Multiply;
const long ACURITE_PULSEMIN = ACURITE_PULSEMIN_D / RawSignal.Multiply;
const long ACURITE_PULSEMINMAX = ACURITE_PULSEMINMAX_D / RawSignal.Multiply;
const long ACURITE_PULSEMAXMIN = ACURITE_PULSEMAXMIN_D / RawSignal.Multiply;

if (RawSignal.Number < ACURITE_PULSECOUNT || RawSignal.Number > (ACURITE_PULSECOUNT + 4))
Expand Down Expand Up @@ -186,7 +184,7 @@ boolean Plugin_037(byte function, const char *string)
display_Header();
display_Name(PSTR("AcuRite 986"));
char c_ID[5];
sprintf(c_ID, "%02x%02x", (rc & 0xFF), rc2);
sprintf(c_ID, "%02lx%02x", (rc & 0xFF), rc2);
display_IDc(c_ID);
display_TEMP(temperature);
display_BAT(battery);
Expand Down

0 comments on commit a46dbe9

Please sign in to comment.