mirror of https://github.com/sebmillet/RF433any
Removes assert from RF433any.h
- RF433any uses its own assert mechanism. I had made it available in RF433any.h so that test.ino could use it, but it is not logical (an RF433any user could face a conflict if using RF433any and their own, or the default, assert). Now assert is defined only in RF433any.cpp. This of course requested test.ino to define its own assert, that was done, too.
This commit is contained in:
parent
08b947ffeb
commit
c88ebb74cf
10
RF433any.cpp
10
RF433any.cpp
|
@ -122,7 +122,15 @@ track -> r_low -> b_short = manage short duration on LOW signal
|
|||
#include "RF433any.h"
|
||||
#include <Arduino.h>
|
||||
|
||||
void assert_failed(int line) {
|
||||
#define ASSERT_OUTPUT_TO_SERIAL
|
||||
|
||||
#define assert(cond) { \
|
||||
if (!(cond)) { \
|
||||
rf433any_assert_failed(__LINE__); \
|
||||
} \
|
||||
}
|
||||
|
||||
static void rf433any_assert_failed(int line) {
|
||||
#ifdef ASSERT_OUTPUT_TO_SERIAL
|
||||
Serial.print("\nRF433any.cpp:");
|
||||
Serial.print(line);
|
||||
|
|
|
@ -102,15 +102,6 @@
|
|||
#define RF433ANY_MAX_SECTIONS 8
|
||||
#endif
|
||||
|
||||
#define ASSERT_OUTPUT_TO_SERIAL
|
||||
|
||||
#define assert(cond) { \
|
||||
if (!(cond)) { \
|
||||
assert_failed(__LINE__); \
|
||||
} \
|
||||
}
|
||||
void assert_failed(int line);
|
||||
|
||||
|
||||
// * **** *********************************************************************
|
||||
// * Band *********************************************************************
|
||||
|
|
|
@ -41,6 +41,24 @@ extern unsigned int sim_int_count_svg;
|
|||
bool filter_mask_set;
|
||||
uint16_t filter_mask;
|
||||
|
||||
#define ASSERT_OUTPUT_TO_SERIAL
|
||||
|
||||
#define assert(cond) { \
|
||||
if (!(cond)) { \
|
||||
assert_failed(__LINE__); \
|
||||
} \
|
||||
}
|
||||
|
||||
static void assert_failed(int line) {
|
||||
#ifdef ASSERT_OUTPUT_TO_SERIAL
|
||||
Serial.print("\nRF433any.cpp:");
|
||||
Serial.print(line);
|
||||
Serial.println(": assertion failed, aborted.");
|
||||
#endif
|
||||
while (1)
|
||||
;
|
||||
}
|
||||
|
||||
void setup() {
|
||||
pinMode(PIN_RFINPUT, INPUT);
|
||||
Serial.begin(115200);
|
||||
|
|
Loading…
Reference in New Issue