diff --git a/.gitignore b/.gitignore index 89cc49c..4c74948 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .vscode/c_cpp_properties.json .vscode/launch.json .vscode/ipch +destination_table diff --git a/src/Log.h b/src/Log.h index 2a4fbd1..b52ac51 100644 --- a/src/Log.h +++ b/src/Log.h @@ -2,6 +2,32 @@ #ifdef ARDUINO #include +#else +// Native-target shims: debug instrumentation in Transport/Destination/Link uses +// Arduino's `Serial`, `millis()`, `delay()`, `random()`, and ESP32's +// `ESP.getFreeHeap()`. Provide no-op stand-ins so the same code compiles +// cleanly on the native unit-test target. +#include +namespace _rns_native_compat { + struct SerialShim { + template void print(A&&...) {} + template void println(A&&...) {} + template void printf(A&&...) {} + void flush() {} + void begin(int) {} + }; + struct ESPShim { + size_t getFreeHeap() const { return 0; } + size_t getFreePsram() const { return 0; } + size_t getPsramSize() const { return 0; } + }; +} +inline _rns_native_compat::SerialShim Serial; +inline _rns_native_compat::ESPShim ESP; +inline unsigned long millis() { return 0; } +inline void delay(unsigned long) {} +inline long random(long min, long max) { return min; } +inline long random(long max) { return 0; } #endif #include