aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2019-11-25 18:41:24 -0700
committerSelene ToyKeeper2019-11-25 18:41:24 -0700
commit1ab6cd428c3b43a80ffac01f29ca0c27a438e3b1 (patch)
tree50b646d29d4b93f3fac409371f734eea3b7f5e8a
parentmade the button LED turn off in momentary mode, instead of staying on forever (diff)
downloadanduril-1ab6cd428c3b43a80ffac01f29ca0c27a438e3b1.tar.gz
anduril-1ab6cd428c3b43a80ffac01f29ca0c27a438e3b1.tar.bz2
anduril-1ab6cd428c3b43a80ffac01f29ca0c27a438e3b1.zip
calibrated Noctigon K1, changed voltage divider calibration values to 10-bit (was 8-bit before)
-rw-r--r--hwdef-BLF_GT.h4
-rw-r--r--hwdef-Emisar_D1Sv2.h6
-rw-r--r--hwdef-Mateminco_MF01S.h4
-rw-r--r--spaghetti-monster/fsm-adc.c2
4 files changed, 9 insertions, 7 deletions
diff --git a/hwdef-BLF_GT.h b/hwdef-BLF_GT.h
index dd8d80a..8ad99c7 100644
--- a/hwdef-BLF_GT.h
+++ b/hwdef-BLF_GT.h
@@ -46,10 +46,10 @@
// Raw ADC readings at 4.4V and 2.2V (in-between, we assume values form a straight line)
#ifndef ADC_44
-#define ADC_44 184
+#define ADC_44 (184*4)
#endif
#ifndef ADC_22
-#define ADC_22 92
+#define ADC_22 (92*4)
#endif
#define TEMP_CHANNEL 0b00001111
diff --git a/hwdef-Emisar_D1Sv2.h b/hwdef-Emisar_D1Sv2.h
index 856643b..d76d701 100644
--- a/hwdef-Emisar_D1Sv2.h
+++ b/hwdef-Emisar_D1Sv2.h
@@ -78,10 +78,12 @@
// (voltage - D1) * (R2/(R2+R1) * 256 / 1.1)
// D1, R1, R2 = 0, 330, 100
#ifndef ADC_44
-#define ADC_44 235
+//#define ADC_44 981 // raw value at 4.40V
+#define ADC_44 967 // manually tweaked so 4.16V will blink out 4.2
#endif
#ifndef ADC_22
-#define ADC_22 116
+//#define ADC_22 489 // raw value at 2.20V
+#define ADC_22 482 // manually tweaked so 4.16V will blink out 4.2
#endif
#define TEMP_CHANNEL 0b00001111
diff --git a/hwdef-Mateminco_MF01S.h b/hwdef-Mateminco_MF01S.h
index ad6194c..03508ab 100644
--- a/hwdef-Mateminco_MF01S.h
+++ b/hwdef-Mateminco_MF01S.h
@@ -46,10 +46,10 @@
// Raw ADC readings at 4.4V and 2.2V (in-between, we assume values form a straight line)
#ifndef ADC_44
-#define ADC_44 234
+#define ADC_44 (234*4)
#endif
#ifndef ADC_22
-#define ADC_22 117
+#define ADC_22 (117*4)
#endif
#define TEMP_CHANNEL 0b00001111
diff --git a/spaghetti-monster/fsm-adc.c b/spaghetti-monster/fsm-adc.c
index 9e52ab6..b8b00de 100644
--- a/spaghetti-monster/fsm-adc.c
+++ b/spaghetti-monster/fsm-adc.c
@@ -101,7 +101,7 @@ inline void ADC_off() {
#ifdef USE_VOLTAGE_DIVIDER
static inline uint8_t calc_voltage_divider(uint16_t value) {
// use 9.7 fixed-point to get sufficient precision
- uint16_t adc_per_volt = ((ADC_44<<7) - (ADC_22<<7)) / (44-22);
+ uint16_t adc_per_volt = ((ADC_44<<5) - (ADC_22<<5)) / (44-22);
// incoming value is 8.2 fixed-point, so shift it 2 bits less
uint8_t result = ((value<<5) / adc_per_volt) + VOLTAGE_FUDGE_FACTOR;
return result;
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.