Пример #1
0
static void draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) {
    switch(cell_index->row) {
    case 0:
        //APP_LOG(APP_LOG_LEVEL_DEBUG, "Current power status: %d", get_lfx_state_power());
        if(get_lfx_state_power()==20) {
            menu_cell_basic_draw(ctx, cell_layer, "Getting status ...", NULL, NULL);
        } else if(get_lfx_state_power()>0) {
            menu_cell_basic_draw(ctx, cell_layer, "Turn off", NULL, NULL);
        } else {
            menu_cell_basic_draw(ctx, cell_layer, "Turn on", NULL, NULL);
        }
        break;
    case 1:
        if(alarm_get()->enabled) {
            snprintf(alarm_text, sizeof(alarm_text), "%02d:%02d",alarm_get()->hour,alarm_get()->minute);
            menu_cell_basic_draw(ctx, cell_layer, "Alarm", alarm_text, NULL);
        } else {
            menu_cell_basic_draw(ctx, cell_layer, "Alarm", "Not activated", NULL);
        }
        break;
    case 2:
        menu_cell_basic_draw(ctx, cell_layer, "Turn off over ...", "Slowly turn off your bulb(s)", NULL);
        break;
    case 3:
        menu_cell_basic_draw(ctx, cell_layer, "Brightness", "Change the brightness", NULL);
        break;
    case 4:
        menu_cell_basic_draw(ctx, cell_layer, "Color", "Change the color", NULL);
        break;
    case 5:
        menu_cell_basic_draw(ctx, cell_layer, "Saturation", "Change the saturation", NULL);
        break;
    case 6:
        menu_cell_basic_draw(ctx, cell_layer, "Settings", "and testing options", NULL);
        break;
    default:
        break;
        menu_cell_basic_draw(ctx, cell_layer, "Toggle", NULL, NULL);
    }
}
Пример #2
0
int cmd_save_eeprom(int argc, char **argv)
{
    alarm_get( ALARM_CT,
               (alarm_t*)&eeprom_data.stored_alarms );
    clock_cur_time_get( (basic_time_t*)&eeprom_data.stored_time);

    if(store_data_write(&eeprom_data))
    {
        cmd_printf("Stored Data\n");
    }
    else
    {
        cmd_printf("Failed to store data\n");
    }
    return 0;
}
Пример #3
0
static void select_callback(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *context) {
    //time_t future_time = time(NULL) + 10;
    //Alarm *alarm = alarm_get();
    switch(cell_index->row) {
    case 0:
        if(get_lfx_state_power()==1) {
            send(TOGGLE, 0);
        } else if(get_lfx_state_power()==0) {
            send(TOGGLE, 1);
        } else {
            send(TOGGLE, 2);
        }
        break;
    case 1:
        //perform_wakeup_tasks();
        win_edit_init();
        win_edit_show(alarm_get());
        break;
    case 2:
        turnOffOver_layer_window_push();
        break;
    case 3:
        brightness_layer_window_push();
        break;
    case 4:
        color_layer_window_push();
        break;
    case 5:
        saturation_layer_window_push();
        break;
    case 6:
        settings_window_init();
        break;
    default:
        break;
    }
}
Пример #4
0
static void dismiss_click_handler(ClickRecognizerRef recognizer, void *context) {
  alarm_get()->enabled=false;
  window_stack_pop(true);
}