TemperatureInterface.cpp 708 B

123456789101112131415161718192021222324252627282930313233
  1. #include "TemperatureInterface.h"
  2. #ifdef __cplusplus
  3. extern "C" {
  4. #endif
  5. uint8_t temprature_sens_read();
  6. #ifdef __cplusplus
  7. }
  8. #endif
  9. uint8_t temprature_sens_read();
  10. TemperatureInterface::TemperatureInterface() {
  11. }
  12. void TemperatureInterface::RunSetup() {
  13. this->initTime = millis();
  14. this->current_temp = this->getCurrentTemp();
  15. }
  16. uint8_t TemperatureInterface::getCurrentTemp() {
  17. return ((temprature_sens_read() - 32) / 1.8);
  18. }
  19. void TemperatureInterface::main(uint32_t currentTime) {
  20. if (currentTime != 0) {
  21. if (currentTime - initTime >= 100) {
  22. //Serial.println("Checking Battery Level");
  23. this->initTime = millis();
  24. this->current_temp = this->getCurrentTemp();
  25. }
  26. }
  27. }