main/ctrl.c
static time_t task_delay_until(time_t until, const char * description)
{
    time_t now;
    time(&now);

    set_status(description, until);
    TickType_t ticks_now = xTaskGetTickCount();
    while ( now < until ) {
        if ( are_lights_on() ) {
            vTaskDelayUntil( &ticks_now, pdMS_TO_TICKS(1000) );
        } else {
            led_on();
            vTaskDelayUntil( &ticks_now, pdMS_TO_TICKS(200) );
            led_off();
            vTaskDelayUntil( &ticks_now, pdMS_TO_TICKS(800) );
        }
        ++now;
    }
    
    time(&now);
    return now;
}
/**
 * Suspends the task until the specified moment in the future.
 *
 * @param until time when the task should be awoken
 * @param description current status
 * @return current time
 */
Suspends the task until the specified moment in the future.
@param until time when the task should be awoken
@param description current status
@return current time
Suspends the task until the specified moment in the future . @param until time when the task should be awoken @param description current status @return current time
static time_t task_delay_until(time_t until, const char * description)
{
    time_t now;
    time(&now);
    set_status(description, until);
    TickType_t ticks_now = xTaskGetTickCount();
    while ( now < until ) {
        if ( are_lights_on() ) {
            vTaskDelayUntil( &ticks_now, pdMS_TO_TICKS(1000) );
        } else {
            led_on();
            vTaskDelayUntil( &ticks_now, pdMS_TO_TICKS(200) );
            led_off();
            vTaskDelayUntil( &ticks_now, pdMS_TO_TICKS(800) );
        }
        ++now;
    }
    time(&now);
    return now;
}
static time_t task_delay_until ( time_t until , const char * description ) { time_t now ; time ( & now ) ; set_status ( description , until ) ; TickType_t ticks_now = xTaskGetTickCount ( ) ; while ( now < until ) { if ( are_lights_on ( ) ) { vTaskDelayUntil ( & ticks_now , pdMS_TO_TICKS ( 1000 ) ) ; } else { led_on ( ) ; vTaskDelayUntil ( & ticks_now , pdMS_TO_TICKS ( 200 ) ) ; led_off ( ) ; vTaskDelayUntil ( & ticks_now , pdMS_TO_TICKS ( 800 ) ) ; } ++ now ; } time ( & now ) ; return now ; }
Suspends the task until the specified moment in the future.
Suspends the task until the specified moment in the future .