liuguijing 3 months ago
commit ae3f25b14a

@ -5,7 +5,7 @@ plugins {
// 10,00,000 major-minor-build // 10,00,000 major-minor-build
def AppMajorVersion = 1 def AppMajorVersion = 1
def AppMinorVersion = 3 def AppMinorVersion = 3
def AppBuildNumber = 96 def AppBuildNumber = 97
def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber def AppVersionName = AppMajorVersion + "." + AppMinorVersion + "." + AppBuildNumber
def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber def AppVersionCode = AppMajorVersion * 100000 + AppMinorVersion * 1000 + AppBuildNumber

@ -52,6 +52,11 @@
#endif #endif
#define CMD_GET_CAMERA_STATUS 310 #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 #define CMD_SET_INIT_STATUS 401
#else // defined(USING_PTZ) #else // defined(USING_PTZ)
@ -74,7 +79,7 @@
#define CMD_SET_485_ENABLE 512 #define CMD_SET_485_ENABLE 512
#define CMD_SET_3V3_PWR_EN 516 #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_ENABLE 504
#define CMD_SET_SENSOR_PWR_ENABLE 505 #define CMD_SET_SENSOR_PWR_ENABLE 505
#define CMD_SET_SENSOR2_ENABLE 506 #define CMD_SET_SENSOR2_ENABLE 506
@ -102,6 +107,13 @@
#define CMD_SET_100M_RESET 526 #define CMD_SET_100M_RESET 526
#define CMD_GET_CAMERA_STATUS 310 #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 #define CMD_SET_INIT_STATUS 401
#endif // USING_PTZ #endif // USING_PTZ
@ -117,7 +129,7 @@
#define CMD_SET_485_EN3 304 #define CMD_SET_485_EN3 304
#define CMD_SET_485_EN2 303 #define CMD_SET_485_EN2 303
#define CMD_SET_SPI_POWER 129 #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_SDCARD_DETECT_EN 364
#define CMD_SET_PIC1_POWER 494 #define CMD_SET_PIC1_POWER 494
#define CMD_SET_OTHER_POWER 493 #define CMD_SET_OTHER_POWER 493
@ -138,6 +150,8 @@
#define CMD_GET_CHARGING_BUS_VOLTAGE_STATE 112 #define CMD_GET_CHARGING_BUS_VOLTAGE_STATE 112
#define CMD_GET_BAT_BUS_VOLTAGE_STATE 117 #define CMD_GET_BAT_BUS_VOLTAGE_STATE 117
#define CMD_SET_INIT_STATUS 0 // 401
#endif // USING_N938 #endif // USING_N938

@ -507,6 +507,9 @@ CPhoneDevice::CPhoneDevice(JavaVM* vm, jobject service, const std::string& appPa
m_collecting = false; m_collecting = false;
localDelayTime = GetMicroTimeStamp(); localDelayTime = GetMicroTimeStamp();
// Reset all powers
GpioControl::setInt(CMD_SET_INIT_STATUS, 1);
RegisterHandlerForSignal(SIGUSR2); RegisterHandlerForSignal(SIGUSR2);
LoadNetworkInfo(); LoadNetworkInfo();
@ -1245,27 +1248,27 @@ float CPhoneDevice::QueryBattaryVoltage(int timesForAvg, bool* isCharging)
int totalVals = 0; int totalVals = 0;
float chargingBusVoltage = 0.0f; float chargingBusVoltage = 0.0f;
int idx = 0; int idx = 0;
XYLOG(XYLOG_SEVERITY_INFO,"WorkStatus BusVoltage"); XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BusVoltage");
for (idx = 0; idx < timesForAvg; idx++) for (idx = 0; idx < timesForAvg; idx++)
{ {
auto now = std::chrono::system_clock::now(); auto now = std::chrono::system_clock::now();
val = GpioControl::getChargingBusVoltage(); val = GpioControl::getChargingBusVoltage();
auto now2 = std::chrono::system_clock::now(); auto now2 = std::chrono::system_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now).count(); auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now).count();
XYLOG(XYLOG_SEVERITY_INFO,"WorkStatus BusVoltage val=%d, time=%lld", val, static_cast<long long>(duration)); XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BusVoltage val=%d, time=%lld", val, static_cast<long long>(duration));
if (val > 1000) if (val > 1000)
{ {
chargingBusVoltage = (float)val / 1000.0; chargingBusVoltage = (float)val / 1000.0;
break; break;
} }
} }
XYLOG(XYLOG_SEVERITY_INFO,"WorkStatus BusVoltage end"); XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BusVoltage end");
if (isCharging != NULL) if (isCharging != NULL)
{ {
*isCharging = chargingBusVoltage > DEFAULT_WARNING_CHARGING_BUS_VOL; *isCharging = chargingBusVoltage > DEFAULT_WARNING_CHARGING_BUS_VOL;
} }
XYLOG(XYLOG_SEVERITY_INFO,"WorkStatus BatteryVoltage"); XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BatteryVoltage");
int matched = 0; int matched = 0;
for (int idx = 0; idx < timesForAvg; idx++) for (int idx = 0; idx < timesForAvg; idx++)
{ {
@ -1273,14 +1276,14 @@ float CPhoneDevice::QueryBattaryVoltage(int timesForAvg, bool* isCharging)
val = GpioControl::getBatteryVoltage(); // // BatVol val = GpioControl::getBatteryVoltage(); // // BatVol
auto now4 = std::chrono::system_clock::now(); auto now4 = std::chrono::system_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now4 - now3).count(); auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(now4 - now3).count();
XYLOG(XYLOG_SEVERITY_INFO,"WorkStatus BatteryVoltage val=%d, time=%lld", val, static_cast<long long>(duration)); XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BatteryVoltage val=%d, time=%lld", val, static_cast<long long>(duration));
if (val > 0) if (val > 0)
{ {
totalVals += val > BATTARY_VOLTAGE_MAX ? BATTARY_VOLTAGE_MAX : val; totalVals += val > BATTARY_VOLTAGE_MAX ? BATTARY_VOLTAGE_MAX : val;
matched++; matched++;
} }
} }
XYLOG(XYLOG_SEVERITY_INFO,"WorkStatus BatteryVoltage end"); XYLOG(XYLOG_SEVERITY_DEBUG, "WorkStatus BatteryVoltage end");
return (matched > 0) ? ((float)totalVals / 1000.0 / matched) : 0; return (matched > 0) ? ((float)totalVals / 1000.0 / matched) : 0;
} }
@ -4919,7 +4922,7 @@ bool CPhoneDevice::OpenSensors(int sensortype)
#ifndef USING_N938 #ifndef USING_N938
#ifndef USING_PTZ #ifndef USING_PTZ
#else #else
GpioControl::TurnOn(CMD_SET_5V_PWR_ENABLE); // GpioControl::TurnOn(CMD_SET_5V_PWR_ENABLE);
GpioControl::TurnOn(CMD_SET_PTZ_PWR_ENABLE); GpioControl::TurnOn(CMD_SET_PTZ_PWR_ENABLE);
#endif #endif
#else #else
@ -4992,7 +4995,7 @@ bool CPhoneDevice::CloseSensors(int sensortype, uint32_t delayedCloseTime)
// GpioControl::TurnOff(CMD_SET_3V3_PWR_ENABLE); // GpioControl::TurnOff(CMD_SET_3V3_PWR_ENABLE);
#ifndef USING_PTZ #ifndef USING_PTZ
#else #else
GpioControl::TurnOffImmediately(CMD_SET_5V_PWR_ENABLE); // GpioControl::TurnOffImmediately(CMD_SET_5V_PWR_ENABLE);
GpioControl::TurnOffImmediately(CMD_SET_PTZ_PWR_ENABLE); GpioControl::TurnOffImmediately(CMD_SET_PTZ_PWR_ENABLE);
#endif #endif
#endif #endif
@ -5008,6 +5011,7 @@ bool CPhoneDevice::CloseSensors(int sensortype, uint32_t delayedCloseTime)
// GpioControl::TurnOff(CMD_SET_3V3_PWR_ENABLE); // GpioControl::TurnOff(CMD_SET_3V3_PWR_ENABLE);
#ifndef USING_PTZ #ifndef USING_PTZ
#else #else
// GpioControl::TurnOff(CMD_SET_5V_PWR_ENABLE, delayedCloseTime);
GpioControl::TurnOff(CMD_SET_PTZ_PWR_ENABLE, delayedCloseTime); GpioControl::TurnOff(CMD_SET_PTZ_PWR_ENABLE, delayedCloseTime);
#endif #endif
#endif #endif

Loading…
Cancel
Save