From 6a804862da6c062b86734a38e8e43ac2066c7c7b Mon Sep 17 00:00:00 2001 From: Oleg Kalachev Date: Wed, 15 Jul 2026 14:17:24 +0300 Subject: [PATCH] Fix simulator build with new logging --- gazebo/Arduino.h | 10 ++++++++++ gazebo/flix.h | 5 +++++ gazebo/simulator.cpp | 2 +- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/gazebo/Arduino.h b/gazebo/Arduino.h index b9b03dd..1d960a7 100644 --- a/gazebo/Arduino.h +++ b/gazebo/Arduino.h @@ -20,6 +20,10 @@ #define radians(deg) ((deg)*DEG_TO_RAD) #define degrees(rad) ((rad)*RAD_TO_DEG) +#define MALLOC_CAP_SPIRAM (1<<10) +#define MALLOC_CAP_8BIT (1<<2) +#define ESP_NOW_MAX_DATA_LEN_V2 1470 + #define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) template T max(T a, T b) { return a > b ? a : b; } template T min(T a, T b) { return a < b ? a : b; } @@ -157,6 +161,7 @@ class EspClass { public: void restart() { Serial.println("Ignore reboot in simulation"); } uint32_t getFreeHeap() { return 300 * 1024; } // assume 300 KB free heap + uint32_t getFreePsram() { return 8 * 1024 * 1024; } // assume 8 MB free PSRAM } ESP; unsigned long __delayTime = 0; @@ -166,11 +171,16 @@ void delay(uint32_t ms) { __delayTime += ms * 1000; } +void *heap_caps_calloc(size_t n, size_t size, uint32_t caps) { + return calloc(n, size); +} + bool ledcAttach(uint8_t pin, uint32_t freq, uint8_t resolution) { return true; } bool ledcWrite(uint8_t pin, uint32_t duty) { return true; } uint32_t ledcChangeFrequency(uint8_t pin, uint32_t freq, uint8_t resolution) { return freq; } int8_t digitalPinToAnalogChannel(uint8_t pin) { return -1; } uint32_t analogReadMilliVolts(uint8_t pin) { return 0; } +float temperatureRead() { return 0; } unsigned long __micros; unsigned long __resetTime = 0; diff --git a/gazebo/flix.h b/gazebo/flix.h index cf1287d..6759416 100644 --- a/gazebo/flix.h +++ b/gazebo/flix.h @@ -89,3 +89,8 @@ void printIMUInfo() {}; void printWiFiInfo() {}; void configWiFi(bool, const char*, const char*) { print("Skip WiFi config\n"); }; void setWiFiMode(const String& mode) { print("Skip WiFi mode set\n"); }; + +class IMU { +public: + float getTemp() { return 0; } +} imu; diff --git a/gazebo/simulator.cpp b/gazebo/simulator.cpp index 8fb94b1..69666cd 100644 --- a/gazebo/simulator.cpp +++ b/gazebo/simulator.cpp @@ -88,7 +88,7 @@ public: applyMotorForces(); publishTopics(); - logData(); + loopLog(); syncParameters(); }