Skip to content

Commit

Permalink
回退电源电压读取函数
Browse files Browse the repository at this point in the history
  • Loading branch information
createskyblue committed Nov 14, 2020
1 parent 466a6bd commit d969e85
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions software/UI_upgrade_by_createskyblue/Program/1.8/1.8t7/F.ino
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,8 @@ uint16_t getVCC() {
// get supply voltage in mV
uint16_t getVIN() {
long result;
result = denoiseAnalog (VIN_PIN); {
if (result < 540) return (result * Vcc / 184.416 + 86.987);
else if (result < 660) return (result * Vcc / 173.204 - 878.29);
else if (result < 745) return (result * Vcc / 143.579 - 4875);
else if (result < 781) return (result * Vcc / 119.109 - 10260);
else if (result < 800) return (result * Vcc / 86.178 - 23013);
else return (result * Vcc / 86.178 - 23113);
} // read supply voltage via voltage divider
//return (result * Vcc / 179.474); // 179.474 = 1023 * R13 / (R12 + R13)
result = denoiseAnalog (VIN_PIN); // read supply voltage via voltage divider
return (result * Vcc / 179.474); // 179.474 = 1023 * R13 / (R12 + R13)
}

//ADC中断服务
Expand Down
Binary file not shown.

0 comments on commit d969e85

Please sign in to comment.