add makefile, fix annoying errors
This commit is contained in:
10
src/aio.c
10
src/aio.c
@@ -80,7 +80,7 @@ static float aio_get_water_temp(libusb_device_handle *dev) {
|
||||
|
||||
static uint16_t aio_get_pump_speed(libusb_device_handle *dev) {
|
||||
POST_AND_GET_RESP(0x31, 5);
|
||||
return resp[3] << 8 | resp[4];
|
||||
return (uint8_t)(resp[3] << 8 | resp[4]);
|
||||
}
|
||||
|
||||
static enum aio_pump_mode_t aio_get_pump_mode(libusb_device_handle *dev) {
|
||||
@@ -91,7 +91,7 @@ static enum aio_pump_mode_t aio_get_pump_mode(libusb_device_handle *dev) {
|
||||
static void aio_get_fan_speed(libusb_device_handle *dev, uint16_t *speeds) {
|
||||
for (uint8_t i = 0; i < 2; i++) {
|
||||
POST_AND_GET_RESP2(0x41, i, 6);
|
||||
speeds[i] = resp[4] << 8 | resp[5];
|
||||
speeds[i] = (uint8_t)(resp[4] << 8 | resp[5]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ static void aio_set_pump_mode(libusb_device_handle *dev, const enum aio_pump_mod
|
||||
if (mode == last_mode)
|
||||
return;
|
||||
applog(LOG_DBG, "setting pump to %u", mode);
|
||||
POST_AND_GET_RESP2(0x32, mode, 6);
|
||||
POST_AND_GET_RESP2(0x32, (uint8_t)mode, 6);
|
||||
last_mode = mode;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ static void aio_set_fan_curve(libusb_device_handle *dev, const struct curve_poin
|
||||
req[9 + i] = padded[i].duty;
|
||||
|
||||
// set curve for both fans
|
||||
for (int i = 0; i < 2; i++) {
|
||||
for (uint8_t i = 0; i < 2; i++) {
|
||||
req[1] = i;
|
||||
aio_post(dev, req, sizeof(req), resp, sizeof(resp));
|
||||
}
|
||||
@@ -230,7 +230,7 @@ void aio_update(struct aio_t *aio) {
|
||||
fan_duty = clamp(fan_duty, params.fans.min_duty, params.fans.max_duty);
|
||||
|
||||
applog(LOG_DBG, "Fan duty %.3f, error %.4f, slope %.4f", (double)fan_duty, (double)error * (double)params.fans.ctrl.Ki, (double)slope * (double)params.fans.ctrl.Kd);
|
||||
SET_FANS_DUTY(aio->handle, fan_duty);
|
||||
SET_FANS_DUTY(aio->handle, (uint8_t)fan_duty);
|
||||
|
||||
/* pump logic */
|
||||
static int16_t counter = 0;
|
||||
|
||||
Reference in New Issue
Block a user