Procházet zdrojové kódy

Fixed current sensing code in firmware

Toby Chui před 5 měsíci
rodič
revize
1ef335e347
1 změnil soubory, kde provedl 1 přidání a 1 odebrání
  1. 1 1
      firmware/pd-psu_v3/pd-psu_v3.ino

+ 1 - 1
firmware/pd-psu_v3/pd-psu_v3.ino

@@ -54,7 +54,7 @@ void loop() {
 
   //Get output current
   currentReading = analogRead(CURRENT_PIN);
-  currentReading = (2.5 - (currentReading * (5.0 / 255))) / 0.185;  //Max range -5A to 5A
+  currentReading = (((float)currentReading * (5.0 / 255.0)) - 2.5) / 0.185 * 100;  //Max range -5A to 5A
   isCCMode = !digitalRead(CCCV_PIN);
 
   //Cap the range of digits to make sure it won't overflow