mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 09:08:41 +00:00
Address review feedback
- Remove unnecessary uint64_t cast on esp_timer_get_time() (already returns int64_t, always non-negative after boot) - Fix next_schedule_in @param comment: now is only unused on ESP32, used for rollover tracking on other platforms - Use fully-qualified friend declaration (::esphome::millis_64())
This commit is contained in:
@@ -23,7 +23,7 @@ namespace esphome {
|
||||
|
||||
void HOT yield() { vPortYield(); }
|
||||
uint32_t IRAM_ATTR HOT millis() { return (uint32_t) (esp_timer_get_time() / 1000ULL); }
|
||||
uint64_t HOT millis_64() { return static_cast<uint64_t>(esp_timer_get_time()) / 1000ULL; }
|
||||
uint64_t HOT millis_64() { return esp_timer_get_time() / 1000; }
|
||||
void HOT delay(uint32_t ms) { vTaskDelay(ms / portTICK_PERIOD_MS); }
|
||||
uint32_t IRAM_ATTR HOT micros() { return (uint32_t) esp_timer_get_time(); }
|
||||
void IRAM_ATTR HOT delayMicroseconds(uint32_t us) { delay_microseconds_safe(us); }
|
||||
|
||||
@@ -121,7 +121,7 @@ class Scheduler {
|
||||
uint64_t millis_64() { return esphome::millis_64(); }
|
||||
|
||||
// Calculate when the next scheduled item should run
|
||||
// @param now Unused, kept for API compatibility
|
||||
// @param now On ESP32, unused (native 64-bit); on other platforms, extended to 64-bit via rollover tracking
|
||||
// Returns the time in milliseconds until the next scheduled item, or nullopt if no items
|
||||
// This method performs cleanup of removed items before checking the schedule
|
||||
// IMPORTANT: This method should only be called from the main thread (loop task).
|
||||
@@ -299,7 +299,7 @@ class Scheduler {
|
||||
// On non-ESP32 platforms, millis_64() HAL function delegates to this method
|
||||
// which tracks 32-bit millis() rollover using millis_major_ and last_millis_.
|
||||
// On ESP32, millis_64() uses esp_timer_get_time() directly.
|
||||
friend uint64_t millis_64();
|
||||
friend uint64_t ::esphome::millis_64();
|
||||
uint64_t millis_64_impl_(uint32_t now);
|
||||
#endif
|
||||
// Cleanup logically deleted items from the scheduler
|
||||
|
||||
Reference in New Issue
Block a user