diff --git a/app/build.gradle b/app/build.gradle index acb038bb..3db911d4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ plugins { // 10,00,000 major-minor-build def AppMajorVersion = 1 def AppMinorVersion = 3 -def AppBuildNumber = 96 +def AppBuildNumber = 97 def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber diff --git a/app/src/main/cpp/GPIOControl.h b/app/src/main/cpp/GPIOControl.h index 841281a8..615dfe2c 100644 --- a/app/src/main/cpp/GPIOControl.h +++ b/app/src/main/cpp/GPIOControl.h @@ -52,6 +52,11 @@ #endif #define CMD_GET_CAMERA_STATUS 310 +#define CMD_SET_MADA_INIT_STATUS 312 +#define CMD_SET_MADA_CLOSE_STATUS 313 +#define CMD_SET_MADA_REG 314 +#define CMD_GET_MADA_REG 315 + #define CMD_SET_INIT_STATUS 401 #else // defined(USING_PTZ) @@ -74,7 +79,7 @@ #define CMD_SET_485_ENABLE 512 #define CMD_SET_3V3_PWR_EN 516 -#define CMD_SET_5V_PWR_ENABLE 517 +// #define CMD_SET_5V_PWR_ENABLE 517 #define CMD_SET_SENSOR_ENABLE 504 #define CMD_SET_SENSOR_PWR_ENABLE 505 #define CMD_SET_SENSOR2_ENABLE 506 @@ -102,6 +107,13 @@ #define CMD_SET_100M_RESET 526 #define CMD_GET_CAMERA_STATUS 310 + +#define CMD_SET_MADA_MOVE_STATUS 311 +#define CMD_SET_MADA_INIT_STATUS 312 +#define CMD_SET_MADA_CLOSE_STATUS 313 +#define CMD_SET_MADA_REG 314 +#define CMD_GET_MADA_REG 315 + #define CMD_SET_INIT_STATUS 401 #endif // USING_PTZ @@ -117,7 +129,7 @@ #define CMD_SET_485_EN3 304 #define CMD_SET_485_EN2 303 #define CMD_SET_SPI_POWER 129 -#define CMD_SET_5V_EN 363 +// #define CMD_SET_5V_EN 363 #define CMD_SDCARD_DETECT_EN 364 #define CMD_SET_PIC1_POWER 494 #define CMD_SET_OTHER_POWER 493 @@ -138,6 +150,8 @@ #define CMD_GET_CHARGING_BUS_VOLTAGE_STATE 112 #define CMD_GET_BAT_BUS_VOLTAGE_STATE 117 +#define CMD_SET_INIT_STATUS 0 // 401 + #endif // USING_N938 diff --git a/app/src/main/cpp/PhoneDevice.cpp b/app/src/main/cpp/PhoneDevice.cpp index 1bfe1957..23384de4 100644 --- a/app/src/main/cpp/PhoneDevice.cpp +++ b/app/src/main/cpp/PhoneDevice.cpp @@ -507,6 +507,9 @@ CPhoneDevice::CPhoneDevice(JavaVM* vm, jobject service, const std::string& appPa m_collecting = false; localDelayTime = GetMicroTimeStamp(); + // Reset all powers + GpioControl::setInt(CMD_SET_INIT_STATUS, 1); + RegisterHandlerForSignal(SIGUSR2); LoadNetworkInfo(); @@ -1245,27 +1248,27 @@ float CPhoneDevice::QueryBattaryVoltage(int timesForAvg, bool* isCharging) int totalVals = 0; float chargingBusVoltage = 0.0f; int idx = 0; - XYLOG(XYLOG_SEVERITY_INFO,"WorkStatus BusVoltage"); + XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BusVoltage"); for (idx = 0; idx < timesForAvg; idx++) { auto now = std::chrono::system_clock::now(); val = GpioControl::getChargingBusVoltage(); auto now2 = std::chrono::system_clock::now(); auto duration = std::chrono::duration_cast(now2 - now).count(); - XYLOG(XYLOG_SEVERITY_INFO,"WorkStatus BusVoltage val=%d, time=%lld", val, static_cast(duration)); + XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BusVoltage val=%d, time=%lld", val, static_cast(duration)); if (val > 1000) { chargingBusVoltage = (float)val / 1000.0; break; } } - XYLOG(XYLOG_SEVERITY_INFO,"WorkStatus BusVoltage end"); + XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BusVoltage end"); if (isCharging != NULL) { *isCharging = chargingBusVoltage > DEFAULT_WARNING_CHARGING_BUS_VOL; } - XYLOG(XYLOG_SEVERITY_INFO,"WorkStatus BatteryVoltage"); + XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BatteryVoltage"); int matched = 0; for (int idx = 0; idx < timesForAvg; idx++) { @@ -1273,14 +1276,14 @@ float CPhoneDevice::QueryBattaryVoltage(int timesForAvg, bool* isCharging) val = GpioControl::getBatteryVoltage(); // // BatVol auto now4 = std::chrono::system_clock::now(); auto duration = std::chrono::duration_cast(now4 - now3).count(); - XYLOG(XYLOG_SEVERITY_INFO,"WorkStatus BatteryVoltage val=%d, time=%lld", val, static_cast(duration)); + XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BatteryVoltage val=%d, time=%lld", val, static_cast(duration)); if (val > 0) { totalVals += val > BATTARY_VOLTAGE_MAX ? BATTARY_VOLTAGE_MAX : val; matched++; } } - XYLOG(XYLOG_SEVERITY_INFO,"WorkStatus BatteryVoltage end"); + XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BatteryVoltage end"); return (matched > 0) ? ((float)totalVals / 1000.0 / matched) : 0; } @@ -4919,7 +4922,7 @@ bool CPhoneDevice::OpenSensors(int sensortype) #ifndef USING_N938 #ifndef USING_PTZ #else - GpioControl::TurnOn(CMD_SET_5V_PWR_ENABLE); + // GpioControl::TurnOn(CMD_SET_5V_PWR_ENABLE); GpioControl::TurnOn(CMD_SET_PTZ_PWR_ENABLE); #endif #else @@ -4992,7 +4995,7 @@ bool CPhoneDevice::CloseSensors(int sensortype, uint32_t delayedCloseTime) // GpioControl::TurnOff(CMD_SET_3V3_PWR_ENABLE); #ifndef USING_PTZ #else - GpioControl::TurnOffImmediately(CMD_SET_5V_PWR_ENABLE); + // GpioControl::TurnOffImmediately(CMD_SET_5V_PWR_ENABLE); GpioControl::TurnOffImmediately(CMD_SET_PTZ_PWR_ENABLE); #endif #endif @@ -5008,6 +5011,7 @@ bool CPhoneDevice::CloseSensors(int sensortype, uint32_t delayedCloseTime) // GpioControl::TurnOff(CMD_SET_3V3_PWR_ENABLE); #ifndef USING_PTZ #else + // GpioControl::TurnOff(CMD_SET_5V_PWR_ENABLE, delayedCloseTime); GpioControl::TurnOff(CMD_SET_PTZ_PWR_ENABLE, delayedCloseTime); #endif #endif