Files
ESPGadget/00_prologue.ino

53 lines
979 B
C++

/*
* Libraries and global scope code
*/
unsigned long lastMillis = 0;
String devname; // Device identifier for MQTT
char nodename[80] = "UNDEF";
struct Settings {
String name = "";
String ip = "";
} settings;
time_t now;
/*
* Debugging might be nice sometimes
*/
#define USE_SERIAL //uncomment for Serial debugging statements
bool serialinitialised = false;
char printbuffer[100];
void PRINT_SERIAL(const String& line) {
#ifdef USE_SERIAL
if(!serialinitialised){
Serial.begin(115200);
serialinitialised = true;
}
Serial.print(settings.ip + " " + settings.name + " ");
Serial.print(line);
#endif
}
void APPEND_SERIAL(const String& line) {
#ifdef USE_SERIAL
Serial.print(line);
#endif
}
void PRINTLN_SERIAL(const String& line) {
#ifdef USE_SERIAL
PRINT_SERIAL(line);
Serial.println();
#endif
}
void APPENDLN_SERIAL(const String& line) {
#ifdef USE_SERIAL
Serial.println(line);
#endif
}
#define NOP __asm__ __volatile__ ("nop\n")