smartknob-ha / firmware

smartknob firmware, esp-idf based instead of tasmota
GNU Affero General Public License v3.0
2 stars 1 forks source link

Make hardware settings dependent on hardware revision #38

Open SquaredPotato opened 3 months ago

SquaredPotato commented 3 months ago

We should add a method to store the hardware revision in some permanent storage, and create a clear structure to define settings like GPIO numbers dependent on the previously stored hardware revision.

abrondijk commented 1 month ago

Easiest way to implement a software readable hardware revision, would be by using a single GPIO as ADC, that reads the voltage value coming out of a voltage divider using 2 resistors.

 Vcc
  |
  R1 (variable depending on hardware revision)
  |
  +------> GPIO ADC (esp32-s3 ADC pin)
  |
  R2 (fixed, 10 kΩ)
  |
 GND
For example: Revision R1 value ADC readout
Rev 1 10K 1.65V
Rev 2 20K 1.1V
Rev 3 30K 0.825V