|
@@ -1065,6 +1065,7 @@ void GetTemperature(char *inputCmd, unsigned int opt)
|
|
|
usleep(10000);
|
|
|
}
|
|
|
}while(keepRun);
|
|
|
+ printf("\r\n");
|
|
|
}
|
|
|
|
|
|
void GetInputVol(char *inputCmd, unsigned int opt)
|
|
@@ -4729,6 +4730,115 @@ void RelayAutoTest(char *inputCmd)
|
|
|
DisableAbnormalRelay();
|
|
|
}
|
|
|
|
|
|
+void RelayAllOn(void)
|
|
|
+{
|
|
|
+ int MaxGunCount = 0;
|
|
|
+
|
|
|
+ MaxGunCount = ShmChargerInfo->Control.MaxConnector;
|
|
|
+
|
|
|
+ for(int i = 0; i < MaxGunCount; i++)
|
|
|
+ {
|
|
|
+ ShmChargerInfo->PsuGrouping.OutputRelayConfig[i].bits.Output_N = YES;
|
|
|
+ ShmChargerInfo->PsuGrouping.OutputRelayConfig[i].bits.Output_P = YES;
|
|
|
+ }
|
|
|
+
|
|
|
+ int ParallelRelayCount = 0;
|
|
|
+
|
|
|
+ if(ShmChargerInfo->Control.MaxConnector == GENERAL_GUN_QUANTITY)
|
|
|
+ {
|
|
|
+ ParallelRelayCount = ShmChargerInfo->Control.SysCtrl.bits.Enable6ParallelRelay == 1 ? PARALLEL_RELAY_COUNT : 3;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ParallelRelayCount = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ for(int i = 0; i < ParallelRelayCount; i++)
|
|
|
+ {
|
|
|
+ ShmChargerInfo->PsuGrouping.ParallelRelayConfig.CtrlValue |= 1 << i;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void RelayAllOff(void)
|
|
|
+{
|
|
|
+ int MaxGunCount = 0;
|
|
|
+
|
|
|
+ MaxGunCount = ShmChargerInfo->Control.MaxConnector;
|
|
|
+
|
|
|
+ for(int i = 0; i < MaxGunCount; i++)
|
|
|
+ {
|
|
|
+ ShmChargerInfo->PsuGrouping.OutputRelayConfig[i].bits.Output_N = NO;
|
|
|
+ ShmChargerInfo->PsuGrouping.OutputRelayConfig[i].bits.Output_P = NO;
|
|
|
+ }
|
|
|
+
|
|
|
+ int ParallelRelayCount = 0;
|
|
|
+
|
|
|
+ if(ShmChargerInfo->Control.MaxConnector == GENERAL_GUN_QUANTITY)
|
|
|
+ {
|
|
|
+ ParallelRelayCount = ShmChargerInfo->Control.SysCtrl.bits.Enable6ParallelRelay == 1 ? PARALLEL_RELAY_COUNT : 3;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ParallelRelayCount = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ for(int i = 0; i < ParallelRelayCount; i++)
|
|
|
+ {
|
|
|
+ ShmChargerInfo->PsuGrouping.ParallelRelayConfig.CtrlValue &= ~(1 << i);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void RelayLongTimeTest(char *inputCmd)
|
|
|
+{
|
|
|
+ int time = 0;
|
|
|
+ struct timespec _Loop_time;
|
|
|
+ bool keepRun = true;
|
|
|
+ bool _relayOn = false;
|
|
|
+
|
|
|
+ if(strcmp(inputCmd, "now") != EQUAL)
|
|
|
+ {
|
|
|
+ printf("\r\n");
|
|
|
+ printf("Input cmd fail ------ relay [timetest] [now]\r\n\r\n");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(!ShmChargerInfo->Control.RelayCtrl.bits.AbnormalRelay)
|
|
|
+ {
|
|
|
+ EnableAbnormalRelay();
|
|
|
+ }
|
|
|
+ printf("Relay Long Time Test Start\r\n");
|
|
|
+
|
|
|
+ do
|
|
|
+ {
|
|
|
+ time = GetTimeoutValue(_Loop_time) / mSEC_VAL;
|
|
|
+ if(time >= 10000)
|
|
|
+ {
|
|
|
+ if(!_relayOn)
|
|
|
+ {
|
|
|
+ printf("Set Relay All On\r\n");
|
|
|
+ RelayAllOn();
|
|
|
+ _relayOn = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ printf("Set Relay All Off\r\n");
|
|
|
+ RelayAllOff();
|
|
|
+ _relayOn = false;
|
|
|
+ }
|
|
|
+ GetClockTime(&_Loop_time);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(keepRun)
|
|
|
+ {
|
|
|
+ keepRun = IsLoopStopCmd() ? false : true;
|
|
|
+ usleep(10000);
|
|
|
+ }
|
|
|
+ }while(keepRun);
|
|
|
+ printf("\r\n");
|
|
|
+
|
|
|
+ DisableAbnormalRelay();
|
|
|
+}
|
|
|
+
|
|
|
void RelayCmd(char *inputCmd, unsigned int opt)
|
|
|
{
|
|
|
char subMain[MAX_SUB_CMD_LENGTH];
|
|
@@ -4768,6 +4878,12 @@ void RelayCmd(char *inputCmd, unsigned int opt)
|
|
|
RelayAutoTest(subSub);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if(strcmp(subMain, "longtime") == EQUAL)
|
|
|
+ {
|
|
|
+ RelayLongTimeTest(subSub);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
printf("\r\n");
|
|
|
printf("Input cmd fail ------ relay [abnormal | write | read | autotest] [...]\r\n\r\n");
|
|
@@ -5102,7 +5218,7 @@ int main(void)
|
|
|
// 取得溫度
|
|
|
GetTemperature(subCmd, option);
|
|
|
}
|
|
|
- else if(strcmp(mainCmd, "acin") == 0)
|
|
|
+ else if(strcmp(mainCmd, "acin") == 0 || strcmp(mainCmd, "input") == 0)
|
|
|
{
|
|
|
// 取得三向輸入電壓
|
|
|
GetInputVol(subCmd, option);
|