Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martonmiklos/f4950173cb961f94a4f6838f233ff22b to your computer and use it in GitHub Desktop.
Save martonmiklos/f4950173cb961f94a4f6838f233ff22b to your computer and use it in GitHub Desktop.
uint8_t batter_check()
{
uint16_t cell_2;
uint16_t cell_3;
uint16_t cell_4;
uint8_t cell_count = 0;
cell_2 = designvoltage / 2;
cell_3 = designvoltage / 3;
cell_4 = designvoltage / 4;
if ((3000 < designvoltage / 2)&&(designvoltage / 2 < 4000))
{
cell_count = 2;
}
if ((3000 < designvoltage / 3)&&(designvoltage / 3 < 4000))
{
cell_count = 3;
}
if ((3000 < designvoltage / 4)&&(designvoltage / 4 < 4000))
{
cell_count = 4;
}
else
{
cell_count = 0;
}
return cell_count;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment