Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback #135

Open
K0I05 opened this issue Feb 22, 2025 · 1 comment
Open

Feedback #135

K0I05 opened this issue Feb 22, 2025 · 1 comment

Comments

@K0I05
Copy link

K0I05 commented Feb 22, 2025

This is a great library, thanks for sharing.

The schedule module is very handy and a decent compromise within the MicroPython environment. I made some modifications to the schedule module, source is here: VS Code + PyMakr.

I created an esp-idf component called time-into-interval that is kind of similar, I may port this to MicroPython. The time_into_interval function returns true when the interval condition has elapsed and it is synchronized with the clock. I use this within a task when you need to trigger an action at a specific interval.

`
time_into_interval_config_t dt_1min_tii_5min_cfg = {
.interval_type = TIME_INTO_INTERVAL_SEC,
.interval_period = 5 * 60,
.interval_offset = 10
};

// create a new time-into-interval handle - task system clock synchronization
time_into_interval_new(&dt_1min_tii_5min_cfg, &dt_1min_tii_5min_hdl);
if (dt_1min_tii_5min_hdl == NULL) ESP_LOGE(APP_TAG, "time_into_interval_new, new time-into-interval handle failed");

for ( ;; ) {
/* print 'hello' every 5-minutes (i.e. 12:00:10, 12:05:10, 12:10:10, etc.) */
if(time_into_interval(dt_1min_tii_5min_hdl)) {
ESP_LOGI(APP_TAG, "Hello World");
}
}
`

esp-idf time-into-interval component

@K0I05
Copy link
Author

K0I05 commented Feb 22, 2025

This is a great library, thanks for sharing.

The schedule module is very handy and a decent compromise within the MicroPython environment. I made some modifications to the schedule module, source is here: VS Code + PyMakr.

I created an esp-idf component called time-into-interval that is kind of similar, I may port this to MicroPython. The time_into_interval function returns true when the interval condition has elapsed and it is synchronized with the clock. I use this within a task when you need to trigger an action at a specific interval.

` time_into_interval_config_t dt_1min_tii_5min_cfg = { .interval_type = TIME_INTO_INTERVAL_SEC, .interval_period = 5 * 60, .interval_offset = 10 };

// create a new time-into-interval handle - task system clock synchronization time_into_interval_new(&dt_1min_tii_5min_cfg, &dt_1min_tii_5min_hdl); if (dt_1min_tii_5min_hdl == NULL) ESP_LOGE(APP_TAG, "time_into_interval_new, new time-into-interval handle failed");

for ( ;; ) { /* print 'hello' every 5-minutes (i.e. 12:00:10, 12:05:10, 12:10:10, etc.) */ if(time_into_interval(dt_1min_tii_5min_hdl)) { ESP_LOGI(APP_TAG, "Hello World"); } } `

esp-idf time-into-interval component

I was able to port the time-into-interval c code to MicroPython: time-into-interval

An example is available here: example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant