|
@@ -34,7 +34,7 @@
|
|
|
#define TIMEOUT_SPEC_POWERSAVING_METER 120
|
|
|
#define TIMEOUT_SPEC_POWERSAVING_LED_STATUS 120
|
|
|
#define TIMEOUT_SPEC_CEHCK_POWER_CONSUMPTION 15
|
|
|
-#define TIMEOUT_SPEC_RESET_WIFI_MODULE 180
|
|
|
+#define TIMEOUT_SPEC_RESET_WIFI_MODULE 300
|
|
|
|
|
|
//==========================
|
|
|
// GPIO constant define
|
|
@@ -44,7 +44,7 @@
|
|
|
#define GPIO_OUT_RST_QCA 115
|
|
|
#define GPIO_OUT_RST_ETH 56
|
|
|
#define GPIO_IN_WAKEUP 63
|
|
|
-#define GPIO_OUT_RST_PWR 59
|
|
|
+#define GPIO_OUT_RST_4G_WIFI 59
|
|
|
|
|
|
#define MtdBlockSize 0x300000
|
|
|
|
|
@@ -2631,52 +2631,28 @@ void InitEthernet()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // Reset wifi function
|
|
|
- if((ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == 1))
|
|
|
- {
|
|
|
- if((!ShmSysConfigAndInfo->SysInfo.OcppConnStatus) &&
|
|
|
- (ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi == ON) &&
|
|
|
- (ShmStatusCodeData->InfoCode.InfoEvents.bits.ApDisconnectViaWiFi == ON))
|
|
|
- {
|
|
|
- if((getDiffSecNow(startTime[0][TMR_IDX_RESET_WIFI]) > TIMEOUT_SPEC_RESET_WIFI_MODULE))
|
|
|
- {
|
|
|
- DEBUG_INFO("Wifi [Station] mode: Reset wifi power. \n");
|
|
|
- DEBUG_INFO("The wifi interface may not be found. \n");
|
|
|
+ // Check is need to reset WIFI/4G module power
|
|
|
+ if(!ShmSysConfigAndInfo->SysInfo.OcppConnStatus &&
|
|
|
|
|
|
- system("echo 1 > /sys/class/gpio/gpio59/value");
|
|
|
- sleep(3);
|
|
|
- system("echo 0 > /sys/class/gpio/gpio59/value");
|
|
|
+ ((system("pidof -s Module_Wifi > /dev/null") != 0) ||
|
|
|
+ (ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == 0) ||
|
|
|
+ ((ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == 1) && (ShmStatusCodeData->InfoCode.InfoEvents.bits.InternetDisconnectViaWiFi == ON)) ||
|
|
|
+ ((ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == 2) && (ShmStatusCodeData->InfoCode.InfoEvents.bits.ApDisconnectViaWiFi == ON))) &&
|
|
|
|
|
|
- refreshStartTimer(&startTime[0][TMR_IDX_RESET_WIFI]);
|
|
|
- }
|
|
|
- else
|
|
|
- {}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- refreshStartTimer(&startTime[0][TMR_IDX_RESET_WIFI]);
|
|
|
- }
|
|
|
- }
|
|
|
- else if((ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode == 2))
|
|
|
+ ((system("pidof -s Module_4g > /dev/null") != 0) ||
|
|
|
+ (ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled == 0) ||
|
|
|
+ ((ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled == 1) && (ShmStatusCodeData->InfoCode.InfoEvents.bits.ApnDisconnectVia4Gi == ON))))
|
|
|
{
|
|
|
- if((ShmStatusCodeData->InfoCode.InfoEvents.bits.ApDisconnectViaWiFi == ON))
|
|
|
+ if(getDiffSecNow(startTime[0][TMR_IDX_RESET_WIFI]) > TIMEOUT_SPEC_RESET_WIFI_MODULE)
|
|
|
{
|
|
|
- if((getDiffSecNow(startTime[0][TMR_IDX_RESET_WIFI]) > TIMEOUT_SPEC_RESET_WIFI_MODULE))
|
|
|
+ if((ShmSysConfigAndInfo->SysConfig.AthInterface.WifiMode != 0) || (ShmSysConfigAndInfo->SysConfig.TelecomInterface.TelcomEnabled != 0))
|
|
|
{
|
|
|
- DEBUG_INFO("Wifi [Access Point] mode: reset wifi power. \n");
|
|
|
- DEBUG_INFO("The wifi interface may not be found. \n");
|
|
|
-
|
|
|
- system("echo 1 > /sys/class/gpio/gpio59/value");
|
|
|
- sleep(3);
|
|
|
- system("echo 0 > /sys/class/gpio/gpio59/value");
|
|
|
-
|
|
|
- refreshStartTimer(&startTime[0][TMR_IDX_RESET_WIFI]);
|
|
|
+ DEBUG_WARN("WIFI/4G module reset.\n");
|
|
|
+ gpio_set_value(GPIO_OUT_RST_4G_WIFI, ON);
|
|
|
+ sleep(1);
|
|
|
+ gpio_set_value(GPIO_OUT_RST_4G_WIFI, OFF);
|
|
|
}
|
|
|
- else
|
|
|
- {}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
+
|
|
|
refreshStartTimer(&startTime[0][TMR_IDX_RESET_WIFI]);
|
|
|
}
|
|
|
}
|