diff --git a/include/aio.h b/include/aio.h index 5f8f310..3a492fa 100644 --- a/include/aio.h +++ b/include/aio.h @@ -46,11 +46,12 @@ struct aio_t { float water_temp; float t_q; float t_b; + float t_e; uint16_t pump_speed; uint16_t fan_speed[2]; }; -void aio_detect(struct aio_t *aio, float t_quiet, float t_balanced); +void aio_detect(struct aio_t *aio, float t_quiet, float t_balanced, float t_extreme); void aio_update(struct aio_t *aio); void aio_close(const struct aio_t *aio); diff --git a/src/aio.c b/src/aio.c index dd0a1e2..eb4cde0 100644 --- a/src/aio.c +++ b/src/aio.c @@ -129,7 +129,7 @@ static void aio_set_fan_curve(libusb_device_handle* dev, const struct curve_poin applog(LOG_INF, "set up AIO fan curve"); } -void aio_detect(struct aio_t *aio, const float t_quiet, const float t_balanced) { +void aio_detect(struct aio_t *aio, const float t_quiet, const float t_balanced, const float t_extreme) { libusb_init(nullptr); aio->handle = libusb_open_device_with_vid_pid(nullptr, AIO_USB_VID, AIO_USB_PID); if (aio->handle == nullptr) { @@ -139,6 +139,7 @@ void aio_detect(struct aio_t *aio, const float t_quiet, const float t_balanced) aio->t_q = t_quiet; aio->t_b = t_balanced; + aio->t_e = t_extreme; const struct curve_point_t fan_curve[] = { { 35, SPD2DTY(360) }, @@ -170,11 +171,15 @@ void aio_update(struct aio_t *aio) { aio->pump_mode = aio_get_pump_mode(aio->handle); aio_get_fan_speed(aio->handle, aio->fan_speed); - if (aio->water_temp > aio->t_b && aio->pump_mode != BALANCED) + if ((aio->pump_mode == QUIET && aio->water_temp > aio->t_b) || (aio->pump_mode == EXTREME && aio->water_temp < aio->t_b)) aio_set_pump_mode(aio->handle, BALANCED); - if (aio->water_temp < aio->t_q && aio->pump_mode != QUIET) - aio_set_pump_mode(aio->handle, QUIET); + if (aio->pump_mode == BALANCED) { + if (aio->water_temp > aio->t_e) + aio_set_pump_mode(aio->handle, EXTREME); + if (aio->water_temp < aio->t_q) + aio_set_pump_mode(aio->handle, QUIET); + } aio_usb_release(aio->handle); } diff --git a/src/main.c b/src/main.c index 1f3ca78..2e036a9 100644 --- a/src/main.c +++ b/src/main.c @@ -108,7 +108,7 @@ static void *display_thread(void *arg) { lcd_set_custom_char(&lcd, 2, &(lcd_glyph_t){0, 0, 8, 21, 21, 2, 0, 0}); // home (tilde) lcd_set_custom_char(&lcd, 3, &(lcd_glyph_t){4, 14, 21, 4, 4, 4, 0}); // up arrow lcd_set_custom_char(&lcd, 4, &(lcd_glyph_t){4, 4, 4, 21, 14, 4, 0}); // down arrow - lcd_set_custom_char(&lcd, 5, &(lcd_glyph_t){0, 0, 15, 21, 21, 17, 15, 0}); // home (tilde) + lcd_set_custom_char(&lcd, 5, &(lcd_glyph_t){0, 0, 15, 21, 21, 17, 15, 0}); // games (steam?) /* main display loop */ applog(LOG_START, "reached display main loop");