diff --git a/src/tempsense.c b/src/tempsense.c --- a/src/tempsense.c +++ b/src/tempsense.c @@ -11,13 +11,13 @@ // Initialize temperature sensor void tempsense_init(void) { - // TODO: Rework SPI stuff... init the port in a sharedlib then pass ref to display and tempsense + // TODO: Rework SPI stuff... init the port in a sharedlib then pass ref to display and tempsense - max31856_init(spi_get(), TEMPSENSE_MAX_CS_PORT, TEMPSENSE_MAX_CS_PIN, 0); + max31856_init(spi_get(), TEMPSENSE_MAX_CS_PORT, TEMPSENSE_MAX_CS_PIN, 0); - // Maybe don't perform temp sensor setup in here, but in readtemp? - // what happens if the user changes the tempsense type while running? - // we need to re-init... + // Maybe don't perform temp sensor setup in here, but in readtemp? + // what happens if the user changes the tempsense type while running? + // we need to re-init... } @@ -25,39 +25,39 @@ void tempsense_init(void) void tempsense_readtemp(void) { - switch(flash_getsettings()->val.sensor_type) - { - case SENSOR_TC_K: - case SENSOR_TC_E: - case SENSOR_TC_N: - case SENSOR_TC_R: - case SENSOR_TC_S: - case SENSOR_TC_T: - { - // Read MAX31856 - max31856_process(); - } break; + switch(flash_getsettings()->val.sensor_type) + { + case SENSOR_TC_K: + case SENSOR_TC_E: + case SENSOR_TC_N: + case SENSOR_TC_R: + case SENSOR_TC_S: + case SENSOR_TC_T: + { + // Read MAX31856 + max31856_process(); + } break; - case SENSOR_NTC: - { - // Read analog value from internal ADC, linearize the reading, etc - } break; + case SENSOR_NTC: + { + // Read analog value from internal ADC, linearize the reading, etc + } break; - } + } - // either return latest reading from DMA loop (NTC, etc) - // or initiate a blocking read and return it. - // Need to gracefully handle the timeout... + // either return latest reading from DMA loop (NTC, etc) + // or initiate a blocking read and return it. + // Need to gracefully handle the timeout... } // Get latest temperature in requested units float tempsense_gettemp(void) { - float temp_converted = max31856_latest_temp(); + float temp_converted = max31856_latest_temp(); - if(flash_getsettings()->val.temp_units == TEMP_UNITS_FAHRENHEIT) - temp_converted = temp_converted * 1.8f + 32.0f; + if(flash_getsettings()->val.temp_units == TEMP_UNITS_FAHRENHEIT) + temp_converted = temp_converted * 1.8f + 32.0f; - return temp_converted; + return temp_converted; }