You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: esp_schedule/README.md
+189Lines changed: 189 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,3 +26,192 @@ See the comprehensive example in [`examples/get_started/`](examples/get_started/
26
26
-**Schedule Management** - Create, edit, enable, and disable schedules
27
27
28
28
The example includes detailed documentation, build instructions, and demonstrates all schedule types with practical use cases.
29
+
30
+
## Triggers as a list
31
+
32
+
Schedules can now contain multiple triggers. Instead of a single `trigger`, use `triggers` with a list and count. Each entry is an `esp_schedule_trigger_t` and the scheduler will trigger on the union of all entries.
esp_schedule_handle_t h = esp_schedule_create(&cfg);
81
+
(void)h;
82
+
}
83
+
```
84
+
85
+
## Date-based triggers (ESP_SCHEDULE_TYPE_DATE)
86
+
87
+
Date-based triggers provide a flexible way to express calendar patterns using a combination of:
88
+
89
+
-**Time of day**: `hours` and `minutes` (24-hour format)
90
+
-**Day-of-week mask**: `day.repeat_days` using `esp_schedule_days_t`
91
+
-**Day-of-month**: `date.day` (1–31)
92
+
-**Months-of-year mask**: `date.repeat_months` using `esp_schedule_months_t`
93
+
-**Specific year**: `date.year` (4-digit), with `date.repeat_every_year`
94
+
95
+
Rules:
96
+
-**At least one** of day-of-week (`day.repeat_days`) or day-of-month (`date.day`) should be set.
97
+
- Day-of-week and day-of-month are combined using **OR**: a date matches if it is on one of the specified weekdays OR it is the specified day of the month.
98
+
- Months and year act as additional filters. If a months mask is set, the date must be within those months. If a year is set (non-zero), only that specific year will match. Use `repeat_every_year = true` when you want the pattern to continue in subsequent years.
These filters are applied when computing the next valid sunrise/sunset for your location. If both day-of-week and day-of-month are specified, they are combined using **OR**; month and year remain additional filters.
188
+
189
+
## Glue Layers
190
+
191
+
This component makes use of the following glue abstraction layers under `glue`:
192
+
- `glue_log.h`: Logging
193
+
- `glue_mem.h`: Memory allocation
194
+
- `glue_nvs.h`: Non-Volatile Storage
195
+
- `glue_time.h`: Time provider and synchronization
196
+
- `glue_timer.h`: Timer implementation
197
+
198
+
### As an ESP-IDF component
199
+
200
+
When using this component normally, the default glue implementations are used:
201
+
- Logging: `glue/esp/glue_log_impl.h`
202
+
- Memory allocation: `glue/esp/glue_mem_impl.h`
203
+
- Non-Volatile Storage: `glue/esp/nvs.c`
204
+
- Time provider and synchronization: `glue/esp/time.c`
205
+
- Timer implementation: `glue/esp/timer.c`
206
+
207
+
### Custom glue implementations
208
+
209
+
If the underlying implementations are required to be changed, then you would need to implement a custom `CMakeLists.txt` for this component:
210
+
1. Common non-glue sources and include directories can be included using `esp_schedule_variables.cmake`.
211
+
2. Append your glue sources and include directories to the variables provided.
212
+
3. Use the variables to build your target library (e.g., passing them to `idf_component_register`).
213
+
4. (Optional) If you wish to **enable NVS**, and the configuration system used is *not compatible with Kconfig files*:
214
+
- You must specify `#define CONFIG_ESP_SCHEDULE_ENABLE_NVS 1` **very early at the top-level include file**.
215
+
- Not doing so will *disable NVS by default*.
216
+
217
+
The [default implementation](#as-an-esp-idf-component) does this in this component's `CMakeLists.txt` with the default glue implementations.
0 commit comments