|
@@ -71,10 +71,11 @@ typedef struct accum_profile {
|
|
|
char * Description;
|
|
|
} accum_profile_t;
|
|
|
|
|
|
-#define ACCUM_PRIFILE_NUM 4
|
|
|
-accum_profile_t Profile[ACCUM_PRIFILE_NUM] = {
|
|
|
+#define ACCUM_PROFILE_NUM 5
|
|
|
+accum_profile_t Profile[ACCUM_PROFILE_NUM] = {
|
|
|
{"SLA", "12V", 12000, 15000, 10500, 3600, 240, {24,0,0}, "GP12120"},
|
|
|
{"SLA", "6V", 1200, 7500, 5250, 360, 24, {24,0,0}, "GP6012"},
|
|
|
+ {"SLA", "12V", 45000, 145000, 10500, 13500, 900, {24,0,0}, "Auto-45AH"},
|
|
|
{"LiIon", "1S1", 3200, 4200, 2500, 1625, 65, {4,0,0}, "NCR18650B"},
|
|
|
{"LiIon", "1S2", 2600, 4200, 2750, 1300, 130, {3,0,0}, "ICR18650-26F"}
|
|
|
};
|
|
@@ -174,7 +175,7 @@ static uint8_t fbuff[1024]; /* Generic large buffer.*/
|
|
|
/*
|
|
|
* INA process thread.
|
|
|
*/
|
|
|
-static THD_WORKING_AREA(waInaThread, 256);
|
|
|
+static THD_WORKING_AREA(waInaThread, 512);
|
|
|
static THD_FUNCTION(InaThread, arg) {
|
|
|
(void)arg;
|
|
|
|
|
@@ -186,8 +187,9 @@ static THD_FUNCTION(InaThread, arg) {
|
|
|
|
|
|
/*
|
|
|
* Charger process thread. Once per second.
|
|
|
+ * Timer for charger
|
|
|
*/
|
|
|
-static THD_WORKING_AREA(waChrgThread, 256);
|
|
|
+static THD_WORKING_AREA(waChrgThread, 512);
|
|
|
static THD_FUNCTION(ChrgThread, arg) {
|
|
|
(void)arg;
|
|
|
|
|
@@ -235,8 +237,8 @@ static THD_FUNCTION(ChrgThread, arg) {
|
|
|
/*
|
|
|
* Green LED blinker thread, times are in milliseconds.
|
|
|
*/
|
|
|
-static THD_WORKING_AREA(waThread1, 128);
|
|
|
-static THD_FUNCTION(Thread1, arg) {
|
|
|
+static THD_WORKING_AREA(waLedThread, 256);
|
|
|
+static THD_FUNCTION(LedThread, arg) {
|
|
|
(void)arg;
|
|
|
chRegSetThreadName("blinker");
|
|
|
while (true) {
|
|
@@ -321,7 +323,7 @@ int main(void) {
|
|
|
/*
|
|
|
* Creates the blinker thread.
|
|
|
*/
|
|
|
- chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO-1, Thread1, NULL);
|
|
|
+ chThdCreateStatic(waLedThread, sizeof(waLedThread), NORMALPRIO-1, LedThread, NULL);
|
|
|
|
|
|
/*
|
|
|
* Creates the charger thread.
|
|
@@ -366,7 +368,7 @@ int main(void) {
|
|
|
charger_State = Stop;
|
|
|
charger_Channel = INA3221_CH1;
|
|
|
|
|
|
- event_listener_t el0, el1, el2, el3;
|
|
|
+ event_listener_t el0, el1, el2, el3, el4, el5;
|
|
|
|
|
|
/* Events initialization and registration.*/
|
|
|
chEvtObjectInit(&ina_all_event);
|
|
@@ -380,8 +382,8 @@ int main(void) {
|
|
|
chEvtRegister(&ina_bus_event, &el1, 1);
|
|
|
chEvtRegister(&chrgr_st_event, &el2, 2);
|
|
|
chEvtRegister(&time_event, &el3, 3);
|
|
|
- chEvtRegister(&inserted_event, &el3, 4);
|
|
|
- chEvtRegister(&removed_event, &el3, 5);
|
|
|
+ chEvtRegister(&inserted_event, &el4, 4);
|
|
|
+ chEvtRegister(&removed_event, &el5, 5);
|
|
|
|
|
|
eventmask_t events;
|
|
|
charger_state_t oldState = Stop;
|
|
@@ -740,7 +742,7 @@ static void btn2_handler(button_state_t state) {
|
|
|
|
|
|
case MenuItem_2:
|
|
|
charger_Profile ++;
|
|
|
- if (charger_Profile >= ACCUM_PRIFILE_NUM) {
|
|
|
+ if (charger_Profile >= ACCUM_PROFILE_NUM) {
|
|
|
charger_Profile = 0;
|
|
|
}
|
|
|
gwinPrintf(GW1, "Select profile for %s\n", Profile[charger_Profile].Description);
|