Files

64 lines
1.5 KiB
C

#pragma once
#include <stdint.h>
#include <stdbool.h>
#define UI_CMD_QUEUE_LEN 8
#define UI_EVT_QUEUE_LEN 16
typedef enum {
CMD_SELECT_PROCESS = 1,
CMD_BROWSE_STEP = 2,
CMD_ADJUST_STEP_TIME = 3,
CMD_ARM_STEP = 4,
CMD_START_STEP = 5,
CMD_STOP = 6,
CMD_RESUME = 7,
CMD_RETURN_TO_STEP_SELECT = 8,
CMD_CANCEL_ARMED = 9,
CMD_PUMP_SET = 100,
CMD_VALVE_SET = 101,
CMD_RESERVOIR_SELECT = 102,
CMD_DRAIN_START = 103,
CMD_DRAIN_STOP = 104,
CMD_HEATER_SETPOINT = 105
} ui_cmd_id_t;
typedef enum {
EVT_PROCESS_SELECTED = 1,
EVT_STEP_VIEW = 2,
EVT_STEP_ARMED = 3,
EVT_STEP_STARTED = 4,
EVT_STEP_PROGRESS = 5,
EVT_STEP_COMPLETE = 6,
EVT_STEP_STOPPED = 7,
EVT_STEP_RESUMED = 8,
EVT_PROCESS_IDLE = 9,
EVT_TEMP_UPDATED = 10,
EVT_FAULT = 11
} ui_evt_id_t;
typedef enum { MOTION_IDLE = 0, MOTION_CW = 1, MOTION_CCW = 2 } motion_t;
typedef struct {
ui_cmd_id_t id;
uint8_t process_id;
int8_t step_delta; /* BrowseStep */
int8_t time_delta_s; /* AdjustStepTime, typically ±5 */
uint8_t step_index; /* Arm/Start */
} ui_cmd_t;
typedef struct {
ui_evt_id_t id;
uint8_t process_id;
uint8_t step_index;
uint8_t step_count;
uint16_t time_s;
uint32_t remaining_ms;
float temp_c; /* NAN if disconnected */
bool temp_ok;
float temp_min_c, temp_pref_c, temp_max_c;
float cw_revs, ccw_revs;
motion_t motion;
int16_t fault_code;
} ui_evt_t;