Esempio n. 1
0
static void
static_setpoint_button_clicked(button_event_t* event)
{
  if (event->id != EVT_BUTTON_CLICK)
    return;

  controller_settings_screen_t* s = widget_get_user_data(event->widget);
  unit_t temp_units = app_cfg_get_temp_unit();
  float min;
  float max;

  char* title;
  if (s->controller == CONTROLLER_1)
    title = "Controller 1 Setpoint";
  else
    title = "Controller 2 Setpoint";

  float velocity_steps[] = {
      0.1f, 0.5f, 1.0f
  };

  if (temp_units == UNIT_TEMP_DEG_F) {
    min = MIN_TEMP_F;
    max = MAX_TEMP_F;
  }
  else{
    min = MIN_TEMP_C;
    max = MAX_TEMP_C;
  }

  widget_t* static_setpoint_screen = quantity_select_screen_create(
      title, s->settings.static_setpoint, min, max,
      velocity_steps, 3, update_static_setpoint, s);
  gui_push_screen(static_setpoint_screen);
}
Esempio n. 2
0
static void
back_button_clicked(button_event_t* event)
{
  if (event->id == EVT_BUTTON_CLICK) {
    controller_settings_screen_t* s = widget_get_user_data(event->widget);

    app_cfg_set_controller_settings(s->controller, SS_DEVICE, &s->settings);

    gui_pop_screen();
  }
}
Esempio n. 3
0
static void
output_settings_button_clicked(button_event_t* event)
{
  if (event->id != EVT_BUTTON_CLICK)
    return;

  output_settings_t* output_settings = widget_get_user_data(event->widget);

  widget_t* settings_screen = output_settings_screen_create(output_settings);
  gui_push_screen(settings_screen);
}
Esempio n. 4
0
static void
probe2_offset_button_clicked(button_event_t* event)
{
  if (event->id != EVT_BUTTON_CLICK)
      return;

  offset_screen_t* s = widget_get_user_data(event->widget);
  s->sensor_id = SENSOR_2;

  build_offset_screen(s, "Probe 2 Offset");
}
Esempio n. 5
0
static void
button_handler(struct widget *widget,
               struct input *input, uint32_t time,
               uint32_t button,
               enum wl_pointer_button_state state, void *data)
{
	struct stacking *stacking = data;

	switch (button) {
	case BTN_RIGHT:
		if (state == WL_POINTER_BUTTON_STATE_PRESSED)
			show_popup(stacking, input, time,
			           widget_get_user_data(widget));
		break;

	case BTN_LEFT:
	default:
		break;
	}
}
Esempio n. 6
0
static void
output_selection_button_clicked(button_event_t* event)
{
  if (event->id == EVT_BUTTON_CLICK) {
    controller_settings_screen_t* s = widget_get_user_data(event->widget);

    /* Find the next valid output selection */
    do {
      if (++s->output_selection >= NUM_OUTPUT_SELECTIONS)
        s->output_selection = 0;
    } while (!s->output_selection_valid[s->output_selection]);

    /* Set output enabled flags accordingly */
    switch (s->output_selection) {
      case SELECT_1:
        s->settings.output_settings[OUTPUT_1].enabled = true;
        s->settings.output_settings[OUTPUT_2].enabled = false;
        break;

      case SELECT_2:
        s->settings.output_settings[OUTPUT_1].enabled = false;
        s->settings.output_settings[OUTPUT_2].enabled = true;
        break;

      case SELECT_1_2:
        s->settings.output_settings[OUTPUT_1].enabled = true;
        s->settings.output_settings[OUTPUT_2].enabled = true;
        break;

      default:
      case SELECT_NONE:
        s->settings.output_settings[OUTPUT_1].enabled = false;
        s->settings.output_settings[OUTPUT_2].enabled = false;
        break;
    }

    set_controller_settings(s);
  }
}
Esempio n. 7
0
static void
setpoint_type_button_clicked(button_event_t* event)
{
  if (event->id == EVT_BUTTON_CLICK) {
    controller_settings_screen_t* s = widget_get_user_data(event->widget);

    setpoint_type_t new_sp_type = SP_STATIC;
    switch (s->settings.setpoint_type) {
      case SP_STATIC:
        new_sp_type = SP_TEMP_PROFILE;
        break;

      case SP_TEMP_PROFILE:
        new_sp_type = SP_STATIC;
        break;

      default:
        break;
    }

    s->settings.setpoint_type = new_sp_type;
    set_controller_settings(s);
  }
}
Esempio n. 8
0
static void
redraw_handler(struct widget *widget, void *data)
{
	struct window *window;
	struct rectangle allocation;
	cairo_t *cr;

	widget_get_allocation(widget, &allocation);
	window = widget_get_user_data(widget);

	cr = widget_cairo_create(widget);
	cairo_translate(cr, allocation.x, allocation.y);

	/* Draw background. */
	cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
	set_window_background_colour(cr, window);
	cairo_rectangle(cr, 0, 0, allocation.width, allocation.height);
	cairo_fill(cr);

	/* Print the instructions. */
	cairo_move_to(cr, 5, 15);
	cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);

	draw_string(cr,
	            "Window: %p\n"
	            "Fullscreen? %u\n"
	            "Maximized? %u\n"
	            "Transient? %u\n"
	            "Keys: (f)ullscreen, (m)aximize,\n"
	            "      (n)ew window, (p)opup,\n"
	            "      (q)uit, (t)ransient window\n",
	            window, window_is_fullscreen(window),
	            window_is_maximized(window), window_get_parent(window) ? 1 : 0);

	cairo_destroy(cr);
}