Forráskód Böngészése

Fixed current sensing code in firmware

Toby Chui 5 hónapja
szülő
commit
1ef335e347
1 módosított fájl, 1 hozzáadás és 1 törlés
  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