Compare commits

..

No commits in common. "c06fa6af065885a1a3e84fbdbc7a95391011d6ac" and "8baccebd7691776a4e7f063d3e924c76c282a321" have entirely different histories.

6 changed files with 48 additions and 52 deletions

View File

@ -18,7 +18,7 @@ enum enumZigBeeTransmitStatus {
//#define NR5G_MODULE //#define NR5G_MODULE
//#define Q4G_MODULE #define Q4G_MODULE
//#define WIFI_MODULE //#define WIFI_MODULE
//#define NR5G_MEIGE //#define NR5G_MEIGE
//#define BLUETEETH_MODULE //#define BLUETEETH_MODULE

View File

@ -78,8 +78,8 @@ int main(int argc, char *argv[]) {
boost::thread uartWaveReadTh(UartStartWave); boost::thread uartWaveReadTh(UartStartWave);
uartWaveReadTh.detach(); uartWaveReadTh.detach();
//启动 RUN LED //启动 RUN LED
// boost::thread startRunLED(RunLED); boost::thread startRunLED(RunLED);
// startRunLED.detach(); startRunLED.detach();
#ifdef NR5G_MODULE #ifdef NR5G_MODULE
@ -119,6 +119,7 @@ int main(int argc, char *argv[]) {
uart_inst::instance().ZigbeeParameterConfig(); uart_inst::instance().ZigbeeParameterConfig();
sleep(1); sleep(1);
uart_inst::instance().UpdateZigbeeInfoCtrl(); uart_inst::instance().UpdateZigbeeInfoCtrl();
//启动 mqtt客户端 //启动 mqtt客户端
boost::thread startMqtt(StartMqttClient); boost::thread startMqtt(StartMqttClient);
startMqtt.detach(); startMqtt.detach();
@ -143,10 +144,13 @@ int main(int argc, char *argv[]) {
zlog_error(zbt, "(this usually indicates a compiler bug - try recompiling\nwithout optimizations, and enable '-DLZO_DEBUG' for diagnostics)"); zlog_error(zbt, "(this usually indicates a compiler bug - try recompiling\nwithout optimizations, and enable '-DLZO_DEBUG' for diagnostics)");
} }
//int fd = OpenWatchDog(); int fd = OpenWatchDog();
int count = 0; int count = 0;
while (GlobalConfig::QuitFlag_G) { while (GlobalConfig::QuitFlag_G) {
//WriteWatchDog(fd); gpio_set(GlobalConfig::GPIO_G.hardWatchDog, 1);
usleep(20000);
gpio_set(GlobalConfig::GPIO_G.hardWatchDog, 0);
WriteWatchDog(fd);
sleep(20); sleep(20);
if (GlobalConfig::threadStatus == 0) { if (GlobalConfig::threadStatus == 0) {
count++; count++;

View File

@ -69,22 +69,22 @@ void HeartRep() {
zlog_info(zct, "heart = %s,iRet = %d", strJson.c_str(), iRet); zlog_info(zct, "heart = %s,iRet = %d", strJson.c_str(), iRet);
} }
// if (iRet != 0) { if (iRet != 0) {
// gpio_set(GlobalConfig::GPIO_G.errorLed, 1); gpio_set(GlobalConfig::GPIO_G.errorLed, 1);
// sleep(1); sleep(1);
// gpio_set(GlobalConfig::GPIO_G.errorLed, 0); gpio_set(GlobalConfig::GPIO_G.errorLed, 0);
// sleep(1); sleep(1);
// gpio_set(GlobalConfig::GPIO_G.errorLed, 1); gpio_set(GlobalConfig::GPIO_G.errorLed, 1);
// sleep(1); sleep(1);
// gpio_set(GlobalConfig::GPIO_G.errorLed, 0); gpio_set(GlobalConfig::GPIO_G.errorLed, 0);
// sleep(1); sleep(1);
// gpio_set(GlobalConfig::GPIO_G.errorLed, 1); gpio_set(GlobalConfig::GPIO_G.errorLed, 1);
// sleep(1); sleep(1);
// GlobalConfig::serverStatus = 1; GlobalConfig::serverStatus = 1;
// } else { } else {
// GlobalConfig::serverStatus = 0; GlobalConfig::serverStatus = 0;
// gpio_set(GlobalConfig::GPIO_G.errorLed, 0); gpio_set(GlobalConfig::GPIO_G.errorLed, 0);
// } }
sleep(30); sleep(30);
count ++; count ++;
} }

View File

@ -157,7 +157,7 @@ Uart::~Uart() {
} }
void Uart::InitUart(speed_t speed) { void Uart::InitUart(speed_t speed) {
fd = config_uart("/dev/ttyS3", speed); fd = config_uart("/dev/ttySC2", speed);
zlog_info(zct, "InitUart fd = %d", fd); zlog_info(zct, "InitUart fd = %d", fd);
if (fd < 0) { if (fd < 0) {
@ -654,8 +654,7 @@ void Uart::DealRecvData(const char *pData) {
nowTimetamp = std::string(localtimestamp); nowTimetamp = std::string(localtimestamp);
last_time = atol(nowTimetamp.c_str()); last_time = atol(nowTimetamp.c_str());
} }
//if (ushortAdd != last_short_addr) if (ushortAdd != last_short_addr){
{
mssleep(50000); mssleep(50000);
ModifyDistAddr(ushortAdd); ModifyDistAddr(ushortAdd);
mssleep(50000); mssleep(50000);

View File

@ -705,17 +705,10 @@ std::vector<float> Uart::DealData(int iChannel, float coe, unsigned int sampleRa
waveCount = VecWaveDataZ.size(); waveCount = VecWaveDataZ.size();
} }
waveCount = m_waveCountZ; waveCount = m_waveCountZ;
printf("\n");
for (; j < waveCount; j++) { for (; j < waveCount; j++) {
RecvData recvData = g_VecWaveDataZ[j]; RecvData recvData = g_VecWaveDataZ[j];
memcpy(data + j * 92, recvData.Data, 92); memcpy(data + j * 92, recvData.Data, 92);
if (j + 3 > waveCount)
{
printf("%02x ",recvData.Order);
} }
}
printf("\n");
memset(buf, 0x00, sizeof(buf)); memset(buf, 0x00, sizeof(buf));
sprintf(buf, "%02x%02x", g_VecWaveDataZ[0].ShortAddr[0], g_VecWaveDataZ[0].ShortAddr[1]); sprintf(buf, "%02x%02x", g_VecWaveDataZ[0].ShortAddr[0], g_VecWaveDataZ[0].ShortAddr[1]);
strShortAddr = std::string(buf); strShortAddr = std::string(buf);

View File

@ -599,13 +599,13 @@ int Uart::TaskResp(ScheduleTask scheduleTask){
mssleep(50000); mssleep(50000);
WriteToUart((const char*)send_data, 100); WriteToUart((const char*)send_data, 100);
// int iRet = CheckZigbeeACK(); int iRet = CheckZigbeeACK();
// if (iRet == 0) { if (iRet == 0) {
// zlog_info(zct, "TaskResp ACK send success,shortAddr = %02x%02x", UINT16_HIGH(scheduleTask.shortAddr),UINT16_LOW(scheduleTask.shortAddr)); zlog_info(zct, "TaskResp ACK send success,shortAddr = %02x%02x", UINT16_HIGH(scheduleTask.shortAddr),UINT16_LOW(scheduleTask.shortAddr));
// } else { } else {
// zlog_warn(zct, "TaskResp ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(scheduleTask.shortAddr),UINT16_LOW(scheduleTask.shortAddr)); zlog_warn(zct, "TaskResp ACK send failed,shortAddr = %02x%02x", UINT16_HIGH(scheduleTask.shortAddr),UINT16_LOW(scheduleTask.shortAddr));
// } }
return 0; return iRet;
} }
int Uart::SendReviveDuration(ReviveDuration recvDuration){ int Uart::SendReviveDuration(ReviveDuration recvDuration){
@ -626,13 +626,13 @@ int Uart::SendReviveDuration(ReviveDuration recvDuration){
} }
UpdateData[99] = tmp; UpdateData[99] = tmp;
WriteToUart((const char*)UpdateData, 100); WriteToUart((const char*)UpdateData, 100);
// int iRet = CheckZigbeeACK(); int iRet = CheckZigbeeACK();
// if (iRet == 0) { if (iRet == 0) {
// zlog_info(zct, "SendReviveDuration ACK send success,shortAddr = %d", recvDuration.shortAddr); zlog_info(zct, "SendReviveDuration ACK send success,shortAddr = %d", recvDuration.shortAddr);
// } else { } else {
// zlog_warn(zct, "SendReviveDuration ACK send failed,shortAddr = %d", recvDuration.shortAddr); zlog_warn(zct, "SendReviveDuration ACK send failed,shortAddr = %d", recvDuration.shortAddr);
// } }
return 0; return iRet;
} }
int Uart::WaveResp(uint16_t shortAddr){ int Uart::WaveResp(uint16_t shortAddr){
unsigned char sendData[8] = {0}; unsigned char sendData[8] = {0};
@ -653,13 +653,13 @@ int Uart::WaveResp(uint16_t shortAddr){
WriteToUart((const char*)sendData, 8); WriteToUart((const char*)sendData, 8);
mssleep(50000); mssleep(50000);
WriteToUart((const char*)sendData, 8); WriteToUart((const char*)sendData, 8);
// int iRet = CheckZigbeeACK(); int iRet = CheckZigbeeACK();
// if (iRet == 0) { if (iRet == 0) {
// zlog_info(zct, "WaveResp ACK send success,shortAddr = %x", shortAddr); zlog_info(zct, "WaveResp ACK send success,shortAddr = %x", shortAddr);
// } else { } else {
// zlog_warn(zct, "WaveResp ACK send failed,shortAddr = %x", shortAddr); zlog_warn(zct, "WaveResp ACK send failed,shortAddr = %x", shortAddr);
// } }
return 0; return iRet;
} }
int Uart::CheckZigbeeACK() { int Uart::CheckZigbeeACK() {
if (gpio_read(GlobalConfig::GPIO_G.zigAckrep) == 48) gpio_set(GlobalConfig::GPIO_G.zigAckreset, 1); if (gpio_read(GlobalConfig::GPIO_G.zigAckrep) == 48) gpio_set(GlobalConfig::GPIO_G.zigAckreset, 1);