mirror of
https://github.com/esphome/esphome.git
synced 2026-09-23 21:14:03 +00:00
Use 1000ULL for consistency, tighten @param comment
- Use 1000ULL divisor in millis_64() to match millis() style and avoid implicit signed-to-unsigned conversion - Clarify next_schedule_in @param: now is unused for 64-bit extension on ESP32, but still used for 32-bit paths in call()
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 esp_timer_get_time() / 1000; }
|
||||
uint64_t HOT millis_64() { return esp_timer_get_time() / 1000ULL; }
|
||||
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); }
|
||||
|
||||
@@ -120,10 +120,10 @@ class Scheduler {
|
||||
/// Get 64-bit millisecond timestamp (handles 32-bit millis() rollover)
|
||||
uint64_t millis_64() { return esphome::millis_64(); }
|
||||
|
||||
// Calculate when the next scheduled item should run
|
||||
// @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
|
||||
// Calculate when the next scheduled item should run.
|
||||
// @param now On ESP32, unused for 64-bit extension (native); on other platforms, extended to 64-bit via rollover.
|
||||
// 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).
|
||||
optional<uint32_t> next_schedule_in(uint32_t now);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user