On full charge turn off LED's

This commit is contained in:
Ben V. Brown 2022-12-29 21:22:36 +11:00
parent 57cc5897e6
commit 4b7a565096
1 changed files with 17 additions and 9 deletions

View File

@ -97,14 +97,14 @@ int app_status_indication_set(APP_STATUS_INDICATION_T status)
struct APP_PWL_CFG_T cfg0; struct APP_PWL_CFG_T cfg0;
struct APP_PWL_CFG_T cfg1; struct APP_PWL_CFG_T cfg1;
TRACE(2,"%s %d",__func__, status);
if (app_status == status) if (app_status == status)
return 0; return 0;
if (app_status_ind_filter == status) if (app_status_ind_filter == status)
return 0; return 0;
TRACE(2,"%s %d",__func__, status);
app_status = status; app_status = status;
memset(&cfg0, 0, sizeof(struct APP_PWL_CFG_T)); memset(&cfg0, 0, sizeof(struct APP_PWL_CFG_T));
memset(&cfg1, 0, sizeof(struct APP_PWL_CFG_T)); memset(&cfg1, 0, sizeof(struct APP_PWL_CFG_T));
@ -160,6 +160,7 @@ int app_status_indication_set(APP_STATUS_INDICATION_T status)
app_pwl_start(APP_PWL_ID_1); app_pwl_start(APP_PWL_ID_1);
break; break;
case APP_STATUS_INDICATION_CONNECTING: case APP_STATUS_INDICATION_CONNECTING:
// LED's alternating Red/Blue
cfg0.part[0].level = 1; cfg0.part[0].level = 1;
cfg0.part[0].time = (300); cfg0.part[0].time = (300);
cfg0.part[1].level = 0; cfg0.part[1].level = 0;
@ -212,25 +213,32 @@ int app_status_indication_set(APP_STATUS_INDICATION_T status)
app_pwl_start(APP_PWL_ID_1); app_pwl_start(APP_PWL_ID_1);
break; break;
case APP_STATUS_INDICATION_FULLCHARGE: case APP_STATUS_INDICATION_FULLCHARGE:
cfg0.part[0].level = 1; cfg0.part[0].level = 0;
cfg0.part[0].time = (5000); cfg0.part[0].time = (5000);
cfg0.parttotal = 1; cfg0.parttotal = 1;
cfg0.startlevel = 1; cfg0.startlevel = 1;
cfg0.periodic = true; cfg0.periodic = false;
app_pwl_setup(APP_PWL_ID_0, &cfg0); app_pwl_setup(APP_PWL_ID_0, &cfg0);
app_pwl_start(APP_PWL_ID_0); app_pwl_start(APP_PWL_ID_0);
app_pwl_setup(APP_PWL_ID_1, &cfg0);
app_pwl_start(APP_PWL_ID_1);
break; break;
case APP_STATUS_INDICATION_POWEROFF: case APP_STATUS_INDICATION_POWEROFF:
cfg1.part[0].level = 1; cfg1.part[0].level = 0;
cfg1.part[0].time = (3000); cfg1.part[0].time = (100);
cfg1.part[1].level = 0; cfg1.parttotal = 1;
cfg1.part[1].time = (200);
cfg1.parttotal = 2;
cfg1.startlevel = 1; cfg1.startlevel = 1;
cfg1.periodic = false; cfg1.periodic = false;
cfg0.part[0].level = 0;
cfg0.part[0].time = (100);
cfg0.parttotal = 1;
cfg0.startlevel = 1;
cfg0.periodic = false;
app_pwl_setup(APP_PWL_ID_1, &cfg1); app_pwl_setup(APP_PWL_ID_1, &cfg1);
app_pwl_start(APP_PWL_ID_1); app_pwl_start(APP_PWL_ID_1);
app_pwl_setup(APP_PWL_ID_0, &cfg0);
app_pwl_start(APP_PWL_ID_0);
break; break;
case APP_STATUS_INDICATION_CHARGENEED: case APP_STATUS_INDICATION_CHARGENEED:
cfg1.part[0].level = 1; cfg1.part[0].level = 1;