huge aio logic rewrite

This commit is contained in:
2026-07-21 20:38:08 +02:00
parent de500dc5e5
commit f4503370fd
2 changed files with 141 additions and 45 deletions

View File

@@ -13,13 +13,24 @@
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
// roughly converts fan speed to duty
#define SPD2DTY(spd) MAX(0, MIN(spd * 100 / max_fan_speed, 100))
struct aio_params_t {
struct {
uint8_t min_duty;
uint8_t max_duty;
bool fan_stop;
float setpoint;
struct {
float Ki;
float Kd;
} ctrl;
} fans;
};
enum aio_pump_mode_t {
QUIET,
BALANCED,
EXTREME
EXTREME,
UNKNOWN
};
enum aio_color_mode_t : uint8_t {
@@ -44,9 +55,7 @@ struct aio_t {
libusb_device_handle* handle;
enum aio_pump_mode_t pump_mode;
float water_temp;
float t_quiet;
float t_balanced;
float t_extreme;
uint16_t pump_counter;
uint16_t pump_speed;
uint16_t fan_speed[2];
};