-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
There are two uses of the word "default" that should be cleaned up. One, is in the help output:
https://github.com/embeddedTS/tsmicroctl/blob/main/tsmicroctl.c#L50
void usage(char **argv, board_t *board)
{
fprintf(stderr,
"Usage: %s [OPTION] ...\n"
"embeddedTS microcontroller utility\n"
"\n"
" -e, --enable Enable charging\n"
" -d, --disable Disables any further charging\n"
" -w, --wait-pct <percent> Enable charging and block until charged to a set percent\n"
" -b, --daemon <percent> Monitor power_fail# and issue \"reboot\" if the supercaps fall below percent\n"
" -i, --info Print current information about supercaps\n"
" -c, --current <mA> Permanently set max charging mA (default: 100, min: %d, max: %d)\n"
" -s, --sleep <seconds> Turns off power to everything for a specified number of seconds\n"
" -h, --help This message\n"
"\n",
argv[0],
board->min_current,
board->max_current);
}Where "default" means "this is the factory default setting that products are configured with."
The other use was from the older silabs implementation, this is actually left over in code in a few places:
https://github.com/embeddedTS/tsmicroctl/blob/main/micro.c#L245-L249
if (micro_read16_swap(i2cfd, MICRO_CHARGE_CURRENT_DEFAULT, &charge_current) < 0) {
perror("Failed to read Supercaps charge current default");
exit(1);
}
printf("supercaps_charge_current_default_ma=%d\n", charge_current);-AND-
https://github.com/embeddedTS/tsmicroctl/blob/main/micro.c#L284-L291
void micro_set_charge_current(int i2cfd, board_t *board, uint16_t ma)
{
assert(ma >= board->min_current);
assert(ma <= board->max_current);
/* Write both the current and persistent charge rate */
micro_write16_swap(i2cfd, MICRO_CHARGE_CURRENT_DEFAULT, &ma);
micro_write16_swap(i2cfd, MICRO_CHARGE_CURRENT, &ma);
}Both of these uses of "default" use it to mean "this is what the charge current is set to on startup automatically."
This should be addressed by changing one of the uses of "default" to something more clear.
Metadata
Metadata
Assignees
Labels
No labels