Merge I2C command handler into main #18

Merged
sebgab merged 15 commits from output-fan-data-over-i2c into main 2024-04-30 08:37:29 +00:00
Showing only changes of commit f654ae96f6 - Show all commits

View File

@ -163,6 +163,9 @@ uint8_t route_command(int pos) {
case WRITE_CONFIG: case WRITE_CONFIG:
return WRITE_CONFIG; return WRITE_CONFIG;
case READ_CONFIG: case READ_CONFIG:
{
switch (context.conf) {
case SAMPLE_TIME:
{ {
// Validate that pos is within the valid range // Validate that pos is within the valid range
if (pos >= 2) { return 0x00; } if (pos >= 2) { return 0x00; }
@ -175,10 +178,11 @@ uint8_t route_command(int pos) {
} config_value; } config_value;
config_value.value = config.ms_fanspeed_sample_rate; config_value.value = config.ms_fanspeed_sample_rate;
uint8_t data = config_value.bytes[1-pos];
// Return the corresponding data byte // Return the corresponding data byte
return data; return config_value.bytes[1-pos];
}
break;
}
} }
break; break;