change to DG102
This commit is contained in:
parent
658de5c5ef
commit
0fabe08c9d
@ -177,20 +177,13 @@ void UartStart() {
|
|||||||
gpio_set(GlobalConfig::GPIO_G.zigReset, 1);
|
gpio_set(GlobalConfig::GPIO_G.zigReset, 1);
|
||||||
zlog_info(zbt, "GPIO Init");
|
zlog_info(zbt, "GPIO Init");
|
||||||
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.errorLed, 1); //指示灯
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.errorLed, 0);
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.power, 1); // power reset
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.power, 0);
|
|
||||||
#endif
|
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.runLed, 1);
|
InitGpio(GlobalConfig::GPIO_G.runLed, 1);
|
||||||
InitGpio(GlobalConfig::GPIO_G.errorLed, 1);
|
InitGpio(GlobalConfig::GPIO_G.errorLed, 1);
|
||||||
gpio_set(GlobalConfig::GPIO_G.runLed, 1);
|
gpio_set(GlobalConfig::GPIO_G.runLed, 1);
|
||||||
gpio_set(GlobalConfig::GPIO_G.errorLed, 0);
|
gpio_set(GlobalConfig::GPIO_G.errorLed, 0);
|
||||||
InitGpio(GlobalConfig::GPIO_G.netResetNet0, 1);
|
InitGpio(GlobalConfig::GPIO_G.netResetNet0, 1);
|
||||||
gpio_set(GlobalConfig::GPIO_G.netResetNet0, 0);
|
gpio_set(GlobalConfig::GPIO_G.netResetNet0, 0);
|
||||||
#endif
|
|
||||||
GlobalConfig::Zigbee_G.Serial_Rate = 0x07;
|
GlobalConfig::Zigbee_G.Serial_Rate = 0x07;
|
||||||
GlobalConfig::Zigbee_G.Serial_DataB = 0x08;
|
GlobalConfig::Zigbee_G.Serial_DataB = 0x08;
|
||||||
GlobalConfig::Zigbee_G.Serial_StopB = 0x01;
|
GlobalConfig::Zigbee_G.Serial_StopB = 0x01;
|
||||||
@ -204,8 +197,6 @@ void UartStart() {
|
|||||||
|
|
||||||
void InitModule() {
|
void InitModule() {
|
||||||
#ifdef NR5G_MODULE
|
#ifdef NR5G_MODULE
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.commPower, 1); // 4G,5G模组供电,
|
InitGpio(GlobalConfig::GPIO_G.commPower, 1); // 4G,5G模组供电,
|
||||||
gpio_set(GlobalConfig::GPIO_G.commPower, 1);
|
gpio_set(GlobalConfig::GPIO_G.commPower, 1);
|
||||||
InitGpio(GlobalConfig::GPIO_G.vol3_8, 1); // 5G 高电平3.8V,低电平3.3V
|
InitGpio(GlobalConfig::GPIO_G.vol3_8, 1); // 5G 高电平3.8V,低电平3.3V
|
||||||
@ -213,15 +204,11 @@ void InitModule() {
|
|||||||
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.commRest, 1);
|
InitGpio(GlobalConfig::GPIO_G.commRest, 1);
|
||||||
gpio_set(GlobalConfig::GPIO_G.commRest, 0); //高电平复位
|
gpio_set(GlobalConfig::GPIO_G.commRest, 0); //高电平复位
|
||||||
#endif // G2UL_GATEWAY
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.commRest, 1);
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.commRest, 1); //
|
|
||||||
#endif // IMX6UL_GATEWAY
|
|
||||||
#endif // NR5G_MODULE
|
#endif // NR5G_MODULE
|
||||||
|
|
||||||
#ifdef Q4G_MODULE
|
#ifdef Q4G_MODULE
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.commPower, 1); // 4G,5G模组供电,
|
InitGpio(GlobalConfig::GPIO_G.commPower, 1); // 4G,5G模组供电,
|
||||||
gpio_set(GlobalConfig::GPIO_G.commPower, 1);
|
gpio_set(GlobalConfig::GPIO_G.commPower, 1);
|
||||||
InitGpio(GlobalConfig::GPIO_G.commRest, 1);
|
InitGpio(GlobalConfig::GPIO_G.commRest, 1);
|
||||||
@ -231,21 +218,9 @@ void InitModule() {
|
|||||||
std::string strAPN = ReadStrByOpt(SERVERCONFIG, "Server", "APN");
|
std::string strAPN = ReadStrByOpt(SERVERCONFIG, "Server", "APN");
|
||||||
sprintf(szquectel, "/opt/quectel-CM/quectel-CM -s %s &", strAPN.c_str());
|
sprintf(szquectel, "/opt/quectel-CM/quectel-CM -s %s &", strAPN.c_str());
|
||||||
system(szquectel);
|
system(szquectel);
|
||||||
#endif // G2UL_GATEWAY
|
|
||||||
#endif // Q4G_MODULE
|
#endif // Q4G_MODULE
|
||||||
#ifdef WIFI_MODULE
|
#ifdef WIFI_MODULE
|
||||||
zlog_info(zbt, "Init WiFi!");
|
zlog_info(zbt, "Init WiFi!");
|
||||||
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.wifiReset, 1); // WiFi模组复位,0复位,1取消复位
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.wifiReset, 1);
|
|
||||||
sleep(10);
|
|
||||||
wifi::WPAClient wpa;
|
|
||||||
wpa.ReconnectWiFi();
|
|
||||||
system("/etc/init.d/wpa_restart");
|
|
||||||
system("udhcpc -i wlan2 &");
|
|
||||||
#endif // IMX6UL_GATEWAY
|
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.wifiReset, 1); // WiFi模组复位,1复位,0取消复位
|
InitGpio(GlobalConfig::GPIO_G.wifiReset, 1); // WiFi模组复位,1复位,0取消复位
|
||||||
gpio_set(GlobalConfig::GPIO_G.wifiReset, 0);
|
gpio_set(GlobalConfig::GPIO_G.wifiReset, 0);
|
||||||
InitGpio(GlobalConfig::GPIO_G.wifiPower, 1); // WiFi模组上电
|
InitGpio(GlobalConfig::GPIO_G.wifiPower, 1); // WiFi模组上电
|
||||||
@ -255,7 +230,6 @@ void InitModule() {
|
|||||||
wpa.ReconnectWiFi();
|
wpa.ReconnectWiFi();
|
||||||
system("/usr/sbin/wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf &");
|
system("/usr/sbin/wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf &");
|
||||||
system("udhcpc -b -i wlan0 &");
|
system("udhcpc -b -i wlan0 &");
|
||||||
#endif // G2UL_GATEWAY
|
|
||||||
#endif // WIFI_MODULE
|
#endif // WIFI_MODULE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -998,8 +998,7 @@ void Uart::WriteDatFile(int sampleRate, std::string &strMeasurementID, int iChan
|
|||||||
} else {
|
} else {
|
||||||
zlog_warn(zct, "send data , filename %s,size = %d\n", strFileName.c_str(), vecData.size());
|
zlog_warn(zct, "send data , filename %s,size = %d\n", strFileName.c_str(), vecData.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef G2UL_GATEWAY //存储6条波形数据
|
|
||||||
char whereCon[1024] = {0x00};
|
char whereCon[1024] = {0x00};
|
||||||
char updateSql[1024] = {0x00};
|
char updateSql[1024] = {0x00};
|
||||||
char tmpWhere[128] = {0x00};
|
char tmpWhere[128] = {0x00};
|
||||||
@ -1043,8 +1042,6 @@ void Uart::WriteDatFile(int sampleRate, std::string &strMeasurementID, int iChan
|
|||||||
system(tmpCmd);
|
system(tmpCmd);
|
||||||
zlog_info(zct, "rm dat file %s ", tmpCmd);
|
zlog_info(zct, "rm dat file %s ", tmpCmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
zlog_info(zct, "write data to filename %s", strFileName.c_str());
|
zlog_info(zct, "write data to filename %s", strFileName.c_str());
|
||||||
std::vector<float>().swap(vecData);
|
std::vector<float>().swap(vecData);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|||||||
@ -13,12 +13,8 @@
|
|||||||
#include "common/global.hpp"
|
#include "common/global.hpp"
|
||||||
|
|
||||||
namespace wifi {
|
namespace wifi {
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
const std::string WPA_PATH = "/var/run/wpa_supplicant/wlan0"; //进程间通信地址加上网络接口额名称
|
const std::string WPA_PATH = "/var/run/wpa_supplicant/wlan0"; //进程间通信地址加上网络接口额名称
|
||||||
#endif
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
const std::string WPA_PATH = "/var/run/wpa_supplicant/wlan2"; //进程间通信地址加上网络接口额名称
|
|
||||||
#endif
|
|
||||||
struct WPAContext {
|
struct WPAContext {
|
||||||
int s;
|
int s;
|
||||||
struct sockaddr_un local;
|
struct sockaddr_un local;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user