|
@@ -1860,6 +1860,346 @@ int main(void)
|
|
|
DEBUG_INFO("ttyS1 port open success.\n");
|
|
|
}
|
|
|
|
|
|
+ // Log output thread
|
|
|
+ if(fork() == 0)
|
|
|
+ {
|
|
|
+ for(;;)
|
|
|
+ {
|
|
|
+ //==========================================================
|
|
|
+ // High priority polling log print out
|
|
|
+ //==========================================================
|
|
|
+ if((current_timestamp() - tsPrintLog[PRIORITY_HIGH]) > (ShmDispenser->gun_info.legacyRequest.isLegacyRequest?3000:6000))
|
|
|
+ {
|
|
|
+ tsPrintLog[PRIORITY_HIGH] = current_timestamp();
|
|
|
+
|
|
|
+ //===============================
|
|
|
+ // Config primary MCU LED
|
|
|
+ //===============================
|
|
|
+ if((previousCharger.gun_info.primaryMcuLed.mode != ShmDispenser->gun_info.primaryMcuLed.mode) ||
|
|
|
+ (previousCharger.gun_info.primaryMcuLed.alarm_code != ShmDispenser->gun_info.primaryMcuLed.alarm_code))
|
|
|
+ {
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 1 ******\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU set Led mode : %d\n", ShmDispenser->gun_info.primaryMcuLed.mode);
|
|
|
+ DEBUG_INFO("MCU set Alarm code : %x\n", ShmDispenser->gun_info.primaryMcuLed.alarm_code);
|
|
|
+
|
|
|
+ previousCharger.gun_info.primaryMcuLed.mode = ShmDispenser->gun_info.primaryMcuLed.mode;
|
|
|
+ previousCharger.gun_info.primaryMcuLed.alarm_code = ShmDispenser->gun_info.primaryMcuLed.alarm_code;
|
|
|
+ }
|
|
|
+
|
|
|
+ //===============================
|
|
|
+ // Config primary Legacy request
|
|
|
+ //===============================
|
|
|
+ if(previousCharger.gun_info.legacyRequest.isLegacyRequest != ShmDispenser->gun_info.legacyRequest.isLegacyRequest)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 2 ******\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU set relay request : %d\n", ShmDispenser->gun_info.legacyRequest.isLegacyRequest);
|
|
|
+
|
|
|
+ previousCharger.gun_info.legacyRequest.isLegacyRequest = ShmDispenser->gun_info.legacyRequest.isLegacyRequest;
|
|
|
+ }
|
|
|
+
|
|
|
+ //===============================
|
|
|
+ // Query primary MCU status
|
|
|
+ //===============================
|
|
|
+ if((previousCharger.gun_info.primaryMcuState.cp_state != ShmDispenser->gun_info.primaryMcuState.cp_state) ||
|
|
|
+ (previousCharger.gun_info.primaryMcuState.current_limit != ShmDispenser->gun_info.primaryMcuState.current_limit) ||
|
|
|
+ (previousCharger.gun_info.primaryMcuState.relay_state != ShmDispenser->gun_info.primaryMcuState.relay_state) ||
|
|
|
+ (previousCharger.gun_info.primaryMcuState.socket_e.isSocketEMode != ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEMode) ||
|
|
|
+ (previousCharger.gun_info.primaryMcuState.socket_e.isSocketEPinOn != ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn))
|
|
|
+ {
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 3 ******\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU get Pilot State : %d\n", ShmDispenser->gun_info.primaryMcuState.cp_state);
|
|
|
+ DEBUG_INFO("MCU get Pilot Duty : %.2f\n", (float)ShmDispenser->gun_info.primaryMcuState.current_limit);
|
|
|
+ DEBUG_INFO("MCU get Pilot Voltage Positive : %.2f\n", ShmDispenser->gun_info.primaryMcuState.cp_voltage_positive);
|
|
|
+ DEBUG_INFO("MCU get Pilot Voltage Negative : %.2f\n", ShmDispenser->gun_info.primaryMcuState.cp_voltage_negtive);
|
|
|
+
|
|
|
+ if(ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn == ON)
|
|
|
+ DEBUG_INFO("Relay on mode : CHARGING_MODE_SOCKETE. \n");
|
|
|
+ else
|
|
|
+ DEBUG_INFO("Relay on mode : CHARGING_MODE_BS / CHARGING_MODE_HLC. \n");
|
|
|
+
|
|
|
+ DEBUG_INFO("MCU get Relay State : %d\n", ShmDispenser->gun_info.primaryMcuState.relay_state);
|
|
|
+ DEBUG_INFO("MCU get Rating Current : %.2f\n", (float)ShmDispenser->gun_info.primaryMcuState.rating_current);
|
|
|
+ DEBUG_INFO("MCU get Rotary switch : %d\n", ShmDispenser->gun_info.primaryMcuState.rotatory_switch);
|
|
|
+ DEBUG_INFO("MCU get is on Socket-E mode : %d\n", ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEMode);
|
|
|
+ DEBUG_INFO("MCU get Socket-E detect pin : %d\n", ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn);
|
|
|
+
|
|
|
+ //===============================
|
|
|
+ // Query primary MCU power consumption
|
|
|
+ //===============================
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 10 *****\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU get total power consumption : %f kWh\n",((float)ShmDispenser->gun_info.powerConsumptionTotal.power_consumption/10000.0));
|
|
|
+ DEBUG_INFO("MCU get L1N_L12 power consumption : %f kWh\n",((float)ShmDispenser->gun_info.powerConsumption[0].power_consumption/10000.0));
|
|
|
+ if(ShmDispenser->ConfigData.AcPhaseCount == 3)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("MCU get L2N_L23 power consumption : %f kWh\n",((float)ShmDispenser->gun_info.powerConsumption[1].power_consumption/10000.0));
|
|
|
+ DEBUG_INFO("MCU get L3N_L31 power consumption : %f kWh\n",((float)ShmDispenser->gun_info.powerConsumption[2].power_consumption/10000.0));
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ DEBUG_INFO("MCU get Locker State : %d\n", ShmDispenser->gun_info.primaryMcuState.locker_state);
|
|
|
+ DEBUG_INFO("MCU get Shutter State : %d\n", ShmDispenser->gun_info.primaryMcuState.shutter_state);
|
|
|
+ DEBUG_INFO("MCU get Meter State : %d\n", ShmDispenser->gun_info.primaryMcuState.meter_state);
|
|
|
+ DEBUG_INFO("MCU get PP State : %d\n", ShmDispenser->gun_info.primaryMcuState.pp_state);
|
|
|
+ */
|
|
|
+
|
|
|
+ previousCharger.gun_info.primaryMcuState.cp_state = ShmDispenser->gun_info.primaryMcuState.cp_state;
|
|
|
+ previousCharger.gun_info.primaryMcuState.current_limit = ShmDispenser->gun_info.primaryMcuState.current_limit;
|
|
|
+ previousCharger.gun_info.primaryMcuState.relay_state = ShmDispenser->gun_info.primaryMcuState.relay_state;
|
|
|
+ previousCharger.gun_info.primaryMcuState.socket_e.isSocketEMode = ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEMode;
|
|
|
+ previousCharger.gun_info.primaryMcuState.socket_e.isSocketEPinOn = ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn;
|
|
|
+ }
|
|
|
+
|
|
|
+ //===============================
|
|
|
+ // Query primary MCU Alarm code
|
|
|
+ //===============================
|
|
|
+ if((previousCharger.gun_info.primaryMcuAlarm.InputAlarmCode != ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode))
|
|
|
+ {
|
|
|
+ if((ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode>0))
|
|
|
+ {
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 4 ******\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU get OVP_L1 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OVP_L1);
|
|
|
+ DEBUG_INFO("MCU get UVP_L1 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.UVP_L1);
|
|
|
+ DEBUG_INFO("MCU get OCP_L1 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OCP_L1);
|
|
|
+ if(ShmDispenser->ConfigData.AcPhaseCount == 3)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("MCU get OVP_L2 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OVP_L2);
|
|
|
+ DEBUG_INFO("MCU get UVP_L2 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.UVP_L2);
|
|
|
+ DEBUG_INFO("MCU get OCP_L2 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OCP_L2);
|
|
|
+ DEBUG_INFO("MCU get OVP_L3 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OVP_L3);
|
|
|
+ DEBUG_INFO("MCU get UVP_L3 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.UVP_L3);
|
|
|
+ DEBUG_INFO("MCU get OCP_L3 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OCP_L3);
|
|
|
+ }
|
|
|
+ DEBUG_INFO("MCU get OTP : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OTP);
|
|
|
+ DEBUG_INFO("MCU get gmi_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.gmi_fault);
|
|
|
+ DEBUG_INFO("MCU get cp_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.cp_fault);
|
|
|
+ DEBUG_INFO("MCU get ac_leak : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.ac_leak);
|
|
|
+ DEBUG_INFO("MCU get dc_leak : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.dc_leak);
|
|
|
+ DEBUG_INFO("MCU get mcu_selftest_fail : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.mcu_selftest_fail);
|
|
|
+ DEBUG_INFO("MCU get handshaking_timeout : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.handshaking_timeout);
|
|
|
+ DEBUG_INFO("MCU get emergency_stop : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.emergency_stop);
|
|
|
+ DEBUG_INFO("MCU get relay_welding : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.relay_welding);
|
|
|
+ DEBUG_INFO("MCU get leak_module_fail : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.leak_module_fail);
|
|
|
+ DEBUG_INFO("MCU get shutter_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.shutter_fault);
|
|
|
+ DEBUG_INFO("MCU get locker_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.locker_fault);
|
|
|
+ DEBUG_INFO("MCU get power_drop : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.power_drop);
|
|
|
+ DEBUG_INFO("MCU get rotate_switch_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.rotate_switch_fault);
|
|
|
+ DEBUG_INFO("MCU get short_circuit_L1 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.short_circuit_L1);
|
|
|
+ if(ShmDispenser->ConfigData.AcPhaseCount == 3)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("MCU get short_circuit_L2 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.short_circuit_L2);
|
|
|
+ DEBUG_INFO("MCU get short_circuit_L3 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.short_circuit_L3);
|
|
|
+ }
|
|
|
+ DEBUG_INFO("MCU get relay_drive_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.relay_drive_fault);
|
|
|
+ DEBUG_INFO("MCU get meter_comm_timeout : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.meter_comm_timeout);
|
|
|
+ DEBUG_INFO("MCU get meter_ic_comm_timeout : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.meter_ic_comm_timeout);
|
|
|
+ DEBUG_INFO("MCU get pilot_negative_error : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.pilot_negative_error);
|
|
|
+ DEBUG_INFO("MCU get InputAlarmCode : %x\n", ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode);
|
|
|
+ }
|
|
|
+
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 1 =====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("MCU get Input voltage L1: %.2f\n", (float)ShmDispenser->gun_info.inputVoltage.L1N_L12);
|
|
|
+ DEBUG_INFO("MCU get PresentChargingVoltage L1: %.2f\n", (float)ShmDispenser->gun_info.inputVoltage.L1N_L12);
|
|
|
+ if(ShmDispenser->ConfigData.AcPhaseCount == 3)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("MCU get Input voltage L2: %f\n", (float)ShmDispenser->gun_info.inputVoltage.L2N_L23);
|
|
|
+ DEBUG_INFO("MCU get PresentChargingVoltage L2: %.2f\n", (float)ShmDispenser->gun_info.inputVoltage.L2N_L23);
|
|
|
+ DEBUG_INFO("MCU get Input voltage L3: %f\n", (float)ShmDispenser->gun_info.inputVoltage.L3N_L31);
|
|
|
+ DEBUG_INFO("MCU get PresentChargingVoltage L3: %.2f\n", (float)ShmDispenser->gun_info.inputVoltage.L3N_L31);
|
|
|
+ }
|
|
|
+
|
|
|
+ previousCharger.gun_info.primaryMcuAlarm.InputAlarmCode = ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode;
|
|
|
+ }
|
|
|
+
|
|
|
+ //===============================
|
|
|
+ // Query primary MCU BLE config
|
|
|
+ //===============================
|
|
|
+ if((previousCharger.gun_info.bleConfigData.isLogin != ShmDispenser->gun_info.bleConfigData.isLogin) ||
|
|
|
+ (previousCharger.gun_info.bleConfigData.isRequestStart != ShmDispenser->gun_info.bleConfigData.isRequestStart) ||
|
|
|
+ (previousCharger.gun_info.bleConfigData.isRequestStop != ShmDispenser->gun_info.bleConfigData.isRequestStop))
|
|
|
+ {
|
|
|
+ if(ShmDispenser->gun_info.bleConfigData.isLogin == ON)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 5 ******\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU get isUserLogin : %d\n", ShmDispenser->gun_info.bleConfigData.isLogin);
|
|
|
+ DEBUG_INFO("MCU get isRequestStartCharger : %d\n", ShmDispenser->gun_info.bleConfigData.isRequestStart);
|
|
|
+ DEBUG_INFO("MCU get isRequestStopCharger : %d\n", ShmDispenser->gun_info.bleConfigData.isRequestStop);
|
|
|
+ }
|
|
|
+
|
|
|
+ previousCharger.gun_info.bleConfigData.isLogin = ShmDispenser->gun_info.bleConfigData.isLogin;
|
|
|
+ previousCharger.gun_info.bleConfigData.isRequestStart = ShmDispenser->gun_info.bleConfigData.isRequestStart;
|
|
|
+ previousCharger.gun_info.bleConfigData.isRequestStop = ShmDispenser->gun_info.bleConfigData.isRequestStop;
|
|
|
+ }
|
|
|
+
|
|
|
+ //===============================
|
|
|
+ // Query primary MCU ble login id
|
|
|
+ //===============================
|
|
|
+ if((strcmp((char *)&previousCharger.gun_info.bleLoginCentralId.id,(char *)&ShmDispenser->gun_info.bleLoginCentralId.id) != 0))
|
|
|
+ {
|
|
|
+ if(strcmp((char *)&ShmDispenser->gun_info.bleLoginCentralId.id,"") != 0)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("***** High priority polling : Case 6 ******\n");
|
|
|
+ DEBUG_INFO("*******************************************\n");
|
|
|
+ DEBUG_INFO("MCU get ble central id : %s\n", ShmDispenser->gun_info.bleLoginCentralId.id);
|
|
|
+ }
|
|
|
+
|
|
|
+ memcpy(&previousCharger.gun_info.bleLoginCentralId.id, ShmDispenser->gun_info.bleLoginCentralId.id, ARRAY_SIZE(ShmDispenser->gun_info.bleLoginCentralId.id));
|
|
|
+ }
|
|
|
+
|
|
|
+ //==========================================================
|
|
|
+ // Low priority polling log print out
|
|
|
+ //==========================================================
|
|
|
+ if((current_timestamp() - tsPrintLog[PRIORITY_LOW]) > (ShmDispenser->gun_info.legacyRequest.isLegacyRequest?3000:6000))
|
|
|
+ {
|
|
|
+ tsPrintLog[PRIORITY_LOW] = current_timestamp();
|
|
|
+
|
|
|
+ switch(logIndex)
|
|
|
+ {
|
|
|
+ case 1:
|
|
|
+ if((previousCharger.gun_info.outputCurrent.L1N_L12[0] != ShmDispenser->gun_info.outputCurrent.L1N_L12[0]) ||
|
|
|
+ (previousCharger.gun_info.outputCurrent.L2N_L23[0] != ShmDispenser->gun_info.outputCurrent.L2N_L23[0]) ||
|
|
|
+ (previousCharger.gun_info.outputCurrent.L3N_L31[0] != ShmDispenser->gun_info.outputCurrent.L3N_L31[0]))
|
|
|
+ {
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 3 =====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("MCU get output current L1: %f\n", (float)ShmDispenser->gun_info.outputCurrent.L1N_L12[0]);
|
|
|
+ if(ShmDispenser->ConfigData.AcPhaseCount == 3)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("MCU get output current L2: %f\n", (float)ShmDispenser->gun_info.outputCurrent.L2N_L23[0]);
|
|
|
+ DEBUG_INFO("MCU get output current L3: %f\n", (float)ShmDispenser->gun_info.outputCurrent.L3N_L31[0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ previousCharger.gun_info.outputCurrent.L1N_L12[0] = ShmDispenser->gun_info.outputCurrent.L1N_L12[0];
|
|
|
+ previousCharger.gun_info.outputCurrent.L2N_L23[0] = ShmDispenser->gun_info.outputCurrent.L2N_L23[0];
|
|
|
+ previousCharger.gun_info.outputCurrent.L3N_L31[0] = ShmDispenser->gun_info.outputCurrent.L3N_L31[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ if(previousCharger.gun_info.gunPluginTimes.GunPluginTimes != ShmDispenser->gun_info.gunPluginTimes.GunPluginTimes)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 5 =====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("MCU get gun plugin times : %ld\n", (long)ShmDispenser->gun_info.gunPluginTimes.GunPluginTimes);
|
|
|
+
|
|
|
+ previousCharger.gun_info.gunPluginTimes.GunPluginTimes = ShmDispenser->gun_info.gunPluginTimes.GunPluginTimes;
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ if(previousCharger.gun_info.temperature.point[0] != ShmDispenser->gun_info.temperature.point[0])
|
|
|
+ {
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 7 =====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("MCU get temperature : %d\n", ShmDispenser->gun_info.temperature.point[0]);
|
|
|
+
|
|
|
+ previousCharger.gun_info.temperature.point[0] = ShmDispenser->gun_info.temperature.point[0];
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ if(previousCharger.gun_info.primaryMcuCp_Pwn_Duty.max_current != ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 9 =====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("MCU set cp pwn duty : %d\n", ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current);
|
|
|
+
|
|
|
+ previousCharger.gun_info.primaryMcuCp_Pwn_Duty.max_current = ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current;
|
|
|
+ }
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 11 ====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ if(ShmDispenser->gun_info.bleConfigData.isLogin && !ShmDispenser->isConnectedBackend)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("Sync from MCU rtc OK...%04d-%02d-%02d %02d:%02d:%02d\n", ShmDispenser->gun_info.rtc.year,
|
|
|
+ ShmDispenser->gun_info.rtc.month,
|
|
|
+ ShmDispenser->gun_info.rtc.day,
|
|
|
+ ShmDispenser->gun_info.rtc.hour,
|
|
|
+ ShmDispenser->gun_info.rtc.min,
|
|
|
+ ShmDispenser->gun_info.rtc.sec);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DEBUG_INFO("MCU set rtc OK...%04d-%02d-%02d %02d:%02d:%02d\n", ShmDispenser->gun_info.rtc.year,
|
|
|
+ ShmDispenser->gun_info.rtc.month,
|
|
|
+ ShmDispenser->gun_info.rtc.day,
|
|
|
+ ShmDispenser->gun_info.rtc.hour,
|
|
|
+ ShmDispenser->gun_info.rtc.min,
|
|
|
+ ShmDispenser->gun_info.rtc.sec);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ if(ShmDispenser->gun_info.isSetBreatheLedTiming == ON)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 17 ====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("MCU set breathe led timing : Authed Fade in [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Authed_Fade_In);
|
|
|
+ DEBUG_INFO("MCU set breathe led timing : Authed Fade out [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Authed_Fade_Out);
|
|
|
+ DEBUG_INFO("MCU set breathe led timing : Charging Fade in [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.Set_Led_Action_Chaging_Fade_In);
|
|
|
+ DEBUG_INFO("MCU set breathe led timing : Charging Fade out [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Chaging_Fade_Out);
|
|
|
+ DEBUG_INFO("MCU set breathe led timing : Connected Fade in [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Connected_Fade_In);
|
|
|
+ DEBUG_INFO("MCU set breathe led timing : Connected Fade out [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Connected_Fade_Out);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ if(ShmDispenser->gun_info.isSetLedBrightness == ON)
|
|
|
+ {
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("==== Normal priority polling : Case 19 ====\n");
|
|
|
+ DEBUG_INFO("===========================================\n");
|
|
|
+ DEBUG_INFO("MCU set led brightness Sector 01 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_1);
|
|
|
+ DEBUG_INFO("MCU set led brightness Sector 02 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_2);
|
|
|
+ DEBUG_INFO("MCU set led brightness Sector 03 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_3);
|
|
|
+ DEBUG_INFO("MCU set led brightness Sector 04 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_4);
|
|
|
+ DEBUG_INFO("MCU set led brightness Sector 05 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_5);
|
|
|
+ DEBUG_INFO("MCU set led brightness Sector 06 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_6);
|
|
|
+ DEBUG_INFO("MCU set led brightness Sector 07 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_7);
|
|
|
+ DEBUG_INFO("MCU set led brightness Sector 08 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_8);
|
|
|
+ DEBUG_INFO("MCU set led brightness Sector 09 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_9);
|
|
|
+ DEBUG_INFO("MCU set led brightness Sector 10 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_10);
|
|
|
+ DEBUG_INFO("MCU set led brightness Sector 11 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_11);
|
|
|
+ DEBUG_INFO("MCU set led brightness Sector 12 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_12);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ logIndex = 0;
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ logIndex++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ usleep(100000);
|
|
|
+ }
|
|
|
+ exit(0);
|
|
|
+ }
|
|
|
+
|
|
|
for(;;)
|
|
|
{
|
|
|
/*
|
|
@@ -2134,201 +2474,7 @@ int main(void)
|
|
|
failCount = FAIL_SPEC_COMM;
|
|
|
}
|
|
|
|
|
|
- //==========================================================
|
|
|
- // High priority polling log print out
|
|
|
- //==========================================================
|
|
|
- if((current_timestamp() - tsPrintLog[PRIORITY_HIGH]) > (ShmDispenser->gun_info.legacyRequest.isLegacyRequest?3000:6000))
|
|
|
- {
|
|
|
- tsPrintLog[PRIORITY_HIGH] = current_timestamp();
|
|
|
-
|
|
|
- //===============================
|
|
|
- // Config primary MCU LED
|
|
|
- //===============================
|
|
|
- if((previousCharger.gun_info.primaryMcuLed.mode != ShmDispenser->gun_info.primaryMcuLed.mode) ||
|
|
|
- (previousCharger.gun_info.primaryMcuLed.alarm_code != ShmDispenser->gun_info.primaryMcuLed.alarm_code))
|
|
|
- {
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("***** High priority polling : Case 1 ******\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU set Led mode : %d\n", ShmDispenser->gun_info.primaryMcuLed.mode);
|
|
|
- DEBUG_INFO("MCU set Alarm code : %x\n", ShmDispenser->gun_info.primaryMcuLed.alarm_code);
|
|
|
-
|
|
|
- previousCharger.gun_info.primaryMcuLed.mode = ShmDispenser->gun_info.primaryMcuLed.mode;
|
|
|
- previousCharger.gun_info.primaryMcuLed.alarm_code = ShmDispenser->gun_info.primaryMcuLed.alarm_code;
|
|
|
- }
|
|
|
-
|
|
|
- //===============================
|
|
|
- // Config primary Legacy request
|
|
|
- //===============================
|
|
|
- if(previousCharger.gun_info.legacyRequest.isLegacyRequest != ShmDispenser->gun_info.legacyRequest.isLegacyRequest)
|
|
|
- {
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("***** High priority polling : Case 2 ******\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU set relay request : %d\n", ShmDispenser->gun_info.legacyRequest.isLegacyRequest);
|
|
|
-
|
|
|
- previousCharger.gun_info.legacyRequest.isLegacyRequest = ShmDispenser->gun_info.legacyRequest.isLegacyRequest;
|
|
|
- }
|
|
|
-
|
|
|
- //===============================
|
|
|
- // Query primary MCU status
|
|
|
- //===============================
|
|
|
- if((previousCharger.gun_info.primaryMcuState.cp_state != ShmDispenser->gun_info.primaryMcuState.cp_state) ||
|
|
|
- (previousCharger.gun_info.primaryMcuState.current_limit != ShmDispenser->gun_info.primaryMcuState.current_limit) ||
|
|
|
- (previousCharger.gun_info.primaryMcuState.relay_state != ShmDispenser->gun_info.primaryMcuState.relay_state) ||
|
|
|
- (previousCharger.gun_info.primaryMcuState.socket_e.isSocketEMode != ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEMode) ||
|
|
|
- (previousCharger.gun_info.primaryMcuState.socket_e.isSocketEPinOn != ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn))
|
|
|
- {
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("***** High priority polling : Case 3 ******\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU get Pilot State : %d\n", ShmDispenser->gun_info.primaryMcuState.cp_state);
|
|
|
- DEBUG_INFO("MCU get Pilot Duty : %.2f\n", (float)ShmDispenser->gun_info.primaryMcuState.current_limit);
|
|
|
- DEBUG_INFO("MCU get Pilot Voltage Positive : %.2f\n", ShmDispenser->gun_info.primaryMcuState.cp_voltage_positive);
|
|
|
- DEBUG_INFO("MCU get Pilot Voltage Negative : %.2f\n", ShmDispenser->gun_info.primaryMcuState.cp_voltage_negtive);
|
|
|
-
|
|
|
- if(ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn == ON)
|
|
|
- DEBUG_INFO("Relay on mode : CHARGING_MODE_SOCKETE. \n");
|
|
|
- else
|
|
|
- DEBUG_INFO("Relay on mode : CHARGING_MODE_BS / CHARGING_MODE_HLC. \n");
|
|
|
-
|
|
|
- DEBUG_INFO("MCU get Relay State : %d\n", ShmDispenser->gun_info.primaryMcuState.relay_state);
|
|
|
- DEBUG_INFO("MCU get Rating Current : %.2f\n", (float)ShmDispenser->gun_info.primaryMcuState.rating_current);
|
|
|
- DEBUG_INFO("MCU get Rotary switch : %d\n", ShmDispenser->gun_info.primaryMcuState.rotatory_switch);
|
|
|
- DEBUG_INFO("MCU get is on Socket-E mode : %d\n", ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEMode);
|
|
|
- DEBUG_INFO("MCU get Socket-E detect pin : %d\n", ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn);
|
|
|
-
|
|
|
- //===============================
|
|
|
- // Query primary MCU power consumption
|
|
|
- //===============================
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("***** High priority polling : Case 10 *****\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU get total power consumption : %f kWh\n",((float)ShmDispenser->gun_info.powerConsumptionTotal.power_consumption/10000.0));
|
|
|
- DEBUG_INFO("MCU get L1N_L12 power consumption : %f kWh\n",((float)ShmDispenser->gun_info.powerConsumption[0].power_consumption/10000.0));
|
|
|
- if(ShmDispenser->ConfigData.AcPhaseCount == 3)
|
|
|
- {
|
|
|
- DEBUG_INFO("MCU get L2N_L23 power consumption : %f kWh\n",((float)ShmDispenser->gun_info.powerConsumption[1].power_consumption/10000.0));
|
|
|
- DEBUG_INFO("MCU get L3N_L31 power consumption : %f kWh\n",((float)ShmDispenser->gun_info.powerConsumption[2].power_consumption/10000.0));
|
|
|
- }
|
|
|
-
|
|
|
- /*
|
|
|
- DEBUG_INFO("MCU get Locker State : %d\n", ShmDispenser->gun_info.primaryMcuState.locker_state);
|
|
|
- DEBUG_INFO("MCU get Shutter State : %d\n", ShmDispenser->gun_info.primaryMcuState.shutter_state);
|
|
|
- DEBUG_INFO("MCU get Meter State : %d\n", ShmDispenser->gun_info.primaryMcuState.meter_state);
|
|
|
- DEBUG_INFO("MCU get PP State : %d\n", ShmDispenser->gun_info.primaryMcuState.pp_state);
|
|
|
- */
|
|
|
-
|
|
|
- previousCharger.gun_info.primaryMcuState.cp_state = ShmDispenser->gun_info.primaryMcuState.cp_state;
|
|
|
- previousCharger.gun_info.primaryMcuState.current_limit = ShmDispenser->gun_info.primaryMcuState.current_limit;
|
|
|
- previousCharger.gun_info.primaryMcuState.relay_state = ShmDispenser->gun_info.primaryMcuState.relay_state;
|
|
|
- previousCharger.gun_info.primaryMcuState.socket_e.isSocketEMode = ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEMode;
|
|
|
- previousCharger.gun_info.primaryMcuState.socket_e.isSocketEPinOn = ShmDispenser->gun_info.primaryMcuState.socket_e.isSocketEPinOn;
|
|
|
- }
|
|
|
-
|
|
|
- //===============================
|
|
|
- // Query primary MCU Alarm code
|
|
|
- //===============================
|
|
|
- if((previousCharger.gun_info.primaryMcuAlarm.InputAlarmCode != ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode))
|
|
|
- {
|
|
|
- if((ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode>0))
|
|
|
- {
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("***** High priority polling : Case 4 ******\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU get OVP_L1 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OVP_L1);
|
|
|
- DEBUG_INFO("MCU get UVP_L1 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.UVP_L1);
|
|
|
- DEBUG_INFO("MCU get OCP_L1 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OCP_L1);
|
|
|
- if(ShmDispenser->ConfigData.AcPhaseCount == 3)
|
|
|
- {
|
|
|
- DEBUG_INFO("MCU get OVP_L2 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OVP_L2);
|
|
|
- DEBUG_INFO("MCU get UVP_L2 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.UVP_L2);
|
|
|
- DEBUG_INFO("MCU get OCP_L2 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OCP_L2);
|
|
|
- DEBUG_INFO("MCU get OVP_L3 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OVP_L3);
|
|
|
- DEBUG_INFO("MCU get UVP_L3 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.UVP_L3);
|
|
|
- DEBUG_INFO("MCU get OCP_L3 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OCP_L3);
|
|
|
- }
|
|
|
- DEBUG_INFO("MCU get OTP : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.OTP);
|
|
|
- DEBUG_INFO("MCU get gmi_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.gmi_fault);
|
|
|
- DEBUG_INFO("MCU get cp_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.cp_fault);
|
|
|
- DEBUG_INFO("MCU get ac_leak : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.ac_leak);
|
|
|
- DEBUG_INFO("MCU get dc_leak : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.dc_leak);
|
|
|
- DEBUG_INFO("MCU get mcu_selftest_fail : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.mcu_selftest_fail);
|
|
|
- DEBUG_INFO("MCU get handshaking_timeout : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.handshaking_timeout);
|
|
|
- DEBUG_INFO("MCU get emergency_stop : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.emergency_stop);
|
|
|
- DEBUG_INFO("MCU get relay_welding : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.relay_welding);
|
|
|
- DEBUG_INFO("MCU get leak_module_fail : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.leak_module_fail);
|
|
|
- DEBUG_INFO("MCU get shutter_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.shutter_fault);
|
|
|
- DEBUG_INFO("MCU get locker_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.locker_fault);
|
|
|
- DEBUG_INFO("MCU get power_drop : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.power_drop);
|
|
|
- DEBUG_INFO("MCU get rotate_switch_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.rotate_switch_fault);
|
|
|
- DEBUG_INFO("MCU get short_circuit_L1 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.short_circuit_L1);
|
|
|
- if(ShmDispenser->ConfigData.AcPhaseCount == 3)
|
|
|
- {
|
|
|
- DEBUG_INFO("MCU get short_circuit_L2 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.short_circuit_L2);
|
|
|
- DEBUG_INFO("MCU get short_circuit_L3 : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.short_circuit_L3);
|
|
|
- }
|
|
|
- DEBUG_INFO("MCU get relay_drive_fault : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.relay_drive_fault);
|
|
|
- DEBUG_INFO("MCU get meter_comm_timeout : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.meter_comm_timeout);
|
|
|
- DEBUG_INFO("MCU get meter_ic_comm_timeout : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.meter_ic_comm_timeout);
|
|
|
- DEBUG_INFO("MCU get pilot_negative_error : %d\n", ShmDispenser->gun_info.primaryMcuAlarm.bits.pilot_negative_error);
|
|
|
- DEBUG_INFO("MCU get InputAlarmCode : %x\n", ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode);
|
|
|
- }
|
|
|
-
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("==== Normal priority polling : Case 1 =====\n");
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("MCU get Input voltage L1: %.2f\n", (float)ShmDispenser->gun_info.inputVoltage.L1N_L12);
|
|
|
- DEBUG_INFO("MCU get PresentChargingVoltage L1: %.2f\n", (float)ShmDispenser->gun_info.inputVoltage.L1N_L12);
|
|
|
- if(ShmDispenser->ConfigData.AcPhaseCount == 3)
|
|
|
- {
|
|
|
- DEBUG_INFO("MCU get Input voltage L2: %f\n", (float)ShmDispenser->gun_info.inputVoltage.L2N_L23);
|
|
|
- DEBUG_INFO("MCU get PresentChargingVoltage L2: %.2f\n", (float)ShmDispenser->gun_info.inputVoltage.L2N_L23);
|
|
|
- DEBUG_INFO("MCU get Input voltage L3: %f\n", (float)ShmDispenser->gun_info.inputVoltage.L3N_L31);
|
|
|
- DEBUG_INFO("MCU get PresentChargingVoltage L3: %.2f\n", (float)ShmDispenser->gun_info.inputVoltage.L3N_L31);
|
|
|
- }
|
|
|
-
|
|
|
- previousCharger.gun_info.primaryMcuAlarm.InputAlarmCode = ShmDispenser->gun_info.primaryMcuAlarm.InputAlarmCode;
|
|
|
- }
|
|
|
-
|
|
|
- //===============================
|
|
|
- // Query primary MCU BLE config
|
|
|
- //===============================
|
|
|
- if((previousCharger.gun_info.bleConfigData.isLogin != ShmDispenser->gun_info.bleConfigData.isLogin) ||
|
|
|
- (previousCharger.gun_info.bleConfigData.isRequestStart != ShmDispenser->gun_info.bleConfigData.isRequestStart) ||
|
|
|
- (previousCharger.gun_info.bleConfigData.isRequestStop != ShmDispenser->gun_info.bleConfigData.isRequestStop))
|
|
|
- {
|
|
|
- if(ShmDispenser->gun_info.bleConfigData.isLogin == ON)
|
|
|
- {
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("***** High priority polling : Case 5 ******\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU get isUserLogin : %d\n", ShmDispenser->gun_info.bleConfigData.isLogin);
|
|
|
- DEBUG_INFO("MCU get isRequestStartCharger : %d\n", ShmDispenser->gun_info.bleConfigData.isRequestStart);
|
|
|
- DEBUG_INFO("MCU get isRequestStopCharger : %d\n", ShmDispenser->gun_info.bleConfigData.isRequestStop);
|
|
|
- }
|
|
|
-
|
|
|
- previousCharger.gun_info.bleConfigData.isLogin = ShmDispenser->gun_info.bleConfigData.isLogin;
|
|
|
- previousCharger.gun_info.bleConfigData.isRequestStart = ShmDispenser->gun_info.bleConfigData.isRequestStart;
|
|
|
- previousCharger.gun_info.bleConfigData.isRequestStop = ShmDispenser->gun_info.bleConfigData.isRequestStop;
|
|
|
- }
|
|
|
|
|
|
- //===============================
|
|
|
- // Query primary MCU ble login id
|
|
|
- //===============================
|
|
|
- if((strcmp((char *)&previousCharger.gun_info.bleLoginCentralId.id,(char *)&ShmDispenser->gun_info.bleLoginCentralId.id) != 0))
|
|
|
- {
|
|
|
- if(strcmp((char *)&ShmDispenser->gun_info.bleLoginCentralId.id,"") != 0)
|
|
|
- {
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("***** High priority polling : Case 6 ******\n");
|
|
|
- DEBUG_INFO("*******************************************\n");
|
|
|
- DEBUG_INFO("MCU get ble central id : %s\n", ShmDispenser->gun_info.bleLoginCentralId.id);
|
|
|
- }
|
|
|
-
|
|
|
- memcpy(&previousCharger.gun_info.bleLoginCentralId.id, ShmDispenser->gun_info.bleLoginCentralId.id, ARRAY_SIZE(ShmDispenser->gun_info.bleLoginCentralId.id));
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -2688,140 +2834,6 @@ int main(void)
|
|
|
stepIndex = 0;
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
- //==========================================================
|
|
|
- // Low priority polling log print out
|
|
|
- //==========================================================
|
|
|
- if((current_timestamp() - tsPrintLog[PRIORITY_LOW]) > (ShmDispenser->gun_info.legacyRequest.isLegacyRequest?3000:6000))
|
|
|
- {
|
|
|
- tsPrintLog[PRIORITY_LOW] = current_timestamp();
|
|
|
-
|
|
|
- switch(logIndex)
|
|
|
- {
|
|
|
- case 1:
|
|
|
- if((previousCharger.gun_info.outputCurrent.L1N_L12[0] != ShmDispenser->gun_info.outputCurrent.L1N_L12[0]) ||
|
|
|
- (previousCharger.gun_info.outputCurrent.L2N_L23[0] != ShmDispenser->gun_info.outputCurrent.L2N_L23[0]) ||
|
|
|
- (previousCharger.gun_info.outputCurrent.L3N_L31[0] != ShmDispenser->gun_info.outputCurrent.L3N_L31[0]))
|
|
|
- {
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("==== Normal priority polling : Case 3 =====\n");
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("MCU get output current L1: %f\n", (float)ShmDispenser->gun_info.outputCurrent.L1N_L12[0]);
|
|
|
- if(ShmDispenser->ConfigData.AcPhaseCount == 3)
|
|
|
- {
|
|
|
- DEBUG_INFO("MCU get output current L2: %f\n", (float)ShmDispenser->gun_info.outputCurrent.L2N_L23[0]);
|
|
|
- DEBUG_INFO("MCU get output current L3: %f\n", (float)ShmDispenser->gun_info.outputCurrent.L3N_L31[0]);
|
|
|
- }
|
|
|
-
|
|
|
- previousCharger.gun_info.outputCurrent.L1N_L12[0] = ShmDispenser->gun_info.outputCurrent.L1N_L12[0];
|
|
|
- previousCharger.gun_info.outputCurrent.L2N_L23[0] = ShmDispenser->gun_info.outputCurrent.L2N_L23[0];
|
|
|
- previousCharger.gun_info.outputCurrent.L3N_L31[0] = ShmDispenser->gun_info.outputCurrent.L3N_L31[0];
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- if(previousCharger.gun_info.gunPluginTimes.GunPluginTimes != ShmDispenser->gun_info.gunPluginTimes.GunPluginTimes)
|
|
|
- {
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("==== Normal priority polling : Case 5 =====\n");
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("MCU get gun plugin times : %ld\n", (long)ShmDispenser->gun_info.gunPluginTimes.GunPluginTimes);
|
|
|
-
|
|
|
- previousCharger.gun_info.gunPluginTimes.GunPluginTimes = ShmDispenser->gun_info.gunPluginTimes.GunPluginTimes;
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- if(previousCharger.gun_info.temperature.point[0] != ShmDispenser->gun_info.temperature.point[0])
|
|
|
- {
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("==== Normal priority polling : Case 7 =====\n");
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("MCU get temperature : %d\n", ShmDispenser->gun_info.temperature.point[0]);
|
|
|
-
|
|
|
- previousCharger.gun_info.temperature.point[0] = ShmDispenser->gun_info.temperature.point[0];
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- case 4:
|
|
|
- if(previousCharger.gun_info.primaryMcuCp_Pwn_Duty.max_current != ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current)
|
|
|
- {
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("==== Normal priority polling : Case 9 =====\n");
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("MCU set cp pwn duty : %d\n", ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current);
|
|
|
-
|
|
|
- previousCharger.gun_info.primaryMcuCp_Pwn_Duty.max_current = ShmDispenser->gun_info.primaryMcuCp_Pwn_Duty.max_current;
|
|
|
- }
|
|
|
-
|
|
|
- break;
|
|
|
- case 5:
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("==== Normal priority polling : Case 11 ====\n");
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- if(ShmDispenser->gun_info.bleConfigData.isLogin && !ShmDispenser->isConnectedBackend)
|
|
|
- {
|
|
|
- DEBUG_INFO("Sync from MCU rtc OK...%04d-%02d-%02d %02d:%02d:%02d\n", ShmDispenser->gun_info.rtc.year,
|
|
|
- ShmDispenser->gun_info.rtc.month,
|
|
|
- ShmDispenser->gun_info.rtc.day,
|
|
|
- ShmDispenser->gun_info.rtc.hour,
|
|
|
- ShmDispenser->gun_info.rtc.min,
|
|
|
- ShmDispenser->gun_info.rtc.sec);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DEBUG_INFO("MCU set rtc OK...%04d-%02d-%02d %02d:%02d:%02d\n", ShmDispenser->gun_info.rtc.year,
|
|
|
- ShmDispenser->gun_info.rtc.month,
|
|
|
- ShmDispenser->gun_info.rtc.day,
|
|
|
- ShmDispenser->gun_info.rtc.hour,
|
|
|
- ShmDispenser->gun_info.rtc.min,
|
|
|
- ShmDispenser->gun_info.rtc.sec);
|
|
|
- }
|
|
|
- break;
|
|
|
- case 6:
|
|
|
- break;
|
|
|
- case 7:
|
|
|
- if(ShmDispenser->gun_info.isSetBreatheLedTiming == ON)
|
|
|
- {
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("==== Normal priority polling : Case 17 ====\n");
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("MCU set breathe led timing : Authed Fade in [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Authed_Fade_In);
|
|
|
- DEBUG_INFO("MCU set breathe led timing : Authed Fade out [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Authed_Fade_Out);
|
|
|
- DEBUG_INFO("MCU set breathe led timing : Charging Fade in [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.Set_Led_Action_Chaging_Fade_In);
|
|
|
- DEBUG_INFO("MCU set breathe led timing : Charging Fade out [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Chaging_Fade_Out);
|
|
|
- DEBUG_INFO("MCU set breathe led timing : Connected Fade in [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Connected_Fade_In);
|
|
|
- DEBUG_INFO("MCU set breathe led timing : Connected Fade out [%ld].\n", (long)ShmDispenser->gun_info.setBreatheLedTiming.set_Led_Action_Connected_Fade_Out);
|
|
|
- }
|
|
|
- break;
|
|
|
- case 8:
|
|
|
- if(ShmDispenser->gun_info.isSetLedBrightness == ON)
|
|
|
- {
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("==== Normal priority polling : Case 19 ====\n");
|
|
|
- DEBUG_INFO("===========================================\n");
|
|
|
- DEBUG_INFO("MCU set led brightness Sector 01 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_1);
|
|
|
- DEBUG_INFO("MCU set led brightness Sector 02 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_2);
|
|
|
- DEBUG_INFO("MCU set led brightness Sector 03 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_3);
|
|
|
- DEBUG_INFO("MCU set led brightness Sector 04 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_4);
|
|
|
- DEBUG_INFO("MCU set led brightness Sector 05 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_5);
|
|
|
- DEBUG_INFO("MCU set led brightness Sector 06 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_6);
|
|
|
- DEBUG_INFO("MCU set led brightness Sector 07 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_7);
|
|
|
- DEBUG_INFO("MCU set led brightness Sector 08 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_8);
|
|
|
- DEBUG_INFO("MCU set led brightness Sector 09 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_9);
|
|
|
- DEBUG_INFO("MCU set led brightness Sector 10 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_10);
|
|
|
- DEBUG_INFO("MCU set led brightness Sector 11 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_11);
|
|
|
- DEBUG_INFO("MCU set led brightness Sector 12 : [%x].\n", ShmDispenser->gun_info.setLedBrightness.sector_12);
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- logIndex = 0;
|
|
|
-
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- logIndex++;
|
|
|
- }
|
|
|
}
|
|
|
stepIndex++;
|
|
|
|