Fork of the espurna firmware for `mhsw` switches
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

  1. // -----------------------------------------------------------------------------
  2. // Abstract emon sensor class (other sensor classes extend this class)
  3. // Copyright (C) 2017-2019 by Xose Pérez <xose dot perez at gmail dot com>
  4. // -----------------------------------------------------------------------------
  5. #pragma once
  6. #include "BaseSensor.h"
  7. class BaseAnalogSensor : public BaseSensor {
  8. public:
  9. virtual unsigned long getR0() { return _R0; }
  10. virtual void setR0(unsigned long value) { _R0 = value; }
  11. virtual unsigned long getRL() { return _Rl; }
  12. virtual void setRL(unsigned long value) { _Rl = value; }
  13. virtual unsigned long getRS() { return _Rs; }
  14. virtual void setRS(unsigned long value) { _Rs = value; }
  15. virtual void calibrate() { }
  16. unsigned char type() { return sensor::type::Analog; }
  17. protected:
  18. unsigned long _R0; // R0, calibration value at 25º
  19. unsigned long _Rl; // RL, load resistance
  20. unsigned long _Rs; // cached resistance
  21. };