Added extra logging around fall detection code.

This commit is contained in:
Graham Jones
2021-11-07 15:54:51 +00:00
parent 0161b93922
commit eb2aff577f
2 changed files with 8 additions and 2 deletions

View File

@@ -457,6 +457,7 @@ public abstract class SdDataSource {
hrCheck(); hrCheck();
fallCheck(); fallCheck();
muteCheck(); muteCheck();
Log.v(TAG,"after fallCheck, mSdData.fallAlarmStanding="+mSdData.fallAlarmStanding);
mSdDataReceiver.onSdDataReceived(mSdData); // and tell SdServer we have received data. mSdDataReceiver.onSdDataReceived(mSdData); // and tell SdServer we have received data.
} }
@@ -570,8 +571,9 @@ public abstract class SdDataSource {
if (mSdData.rawData[i + j] < minAcc) minAcc = mSdData.rawData[i + j]; if (mSdData.rawData[i + j] < minAcc) minAcc = mSdData.rawData[i + j];
if (mSdData.rawData[i + j] > maxAcc) maxAcc = mSdData.rawData[i + j]; if (mSdData.rawData[i + j] > maxAcc) maxAcc = mSdData.rawData[i + j];
} }
Log.d(TAG, "check_fall() - minAcc=" + minAcc +" (mFallThreshMin="+mFallThreshMin+ "), maxAcc=" + maxAcc+" (mFallThreshMax="+mFallThreshMax+")") ;
if ((minAcc < mFallThreshMin) && (maxAcc > mFallThreshMax)) { if ((minAcc < mFallThreshMin) && (maxAcc > mFallThreshMax)) {
Log.d(TAG, "check_fall() - minAcc=" + minAcc + ", maxAcc=" + maxAcc); Log.d(TAG, "check_fall() ****FALL DETECTED***** minAcc=" + minAcc + ", maxAcc=" + maxAcc);
Log.d(TAG, "check_fall() - ****FALL DETECTED****"); Log.d(TAG, "check_fall() - ****FALL DETECTED****");
mSdData.fallAlarmStanding = true; mSdData.fallAlarmStanding = true;
return; return;

View File

@@ -296,8 +296,9 @@ public class SdServer extends Service implements SdDataReceiver {
showNotification(0); showNotification(0);
} }
// Record last time we sent an SMS so we can limit rate of SMS // Record last time we sent an SMS so we can limit rate of SMS
// sending to one per minute. // sending to one per minute. We set it to one minute ago (60000 milliseconds)
mSMSTime = new Time(Time.getCurrentTimezone()); mSMSTime = new Time(Time.getCurrentTimezone());
mSMSTime.set(mSMSTime.toMillis(false)-60000);
// Start timer to log data regularly.. // Start timer to log data regularly..
@@ -529,6 +530,8 @@ public class SdServer extends Service implements SdDataReceiver {
*/ */
public void onSdDataReceived(SdData sdData) { public void onSdDataReceived(SdData sdData) {
Log.v(TAG, "onSdDataReceived() - " + sdData.toString()); Log.v(TAG, "onSdDataReceived() - " + sdData.toString());
Log.v(TAG,"onSdDataReceived(), sdData.fallAlarmStanding="+sdData.fallAlarmStanding);
if (sdData.alarmState == 0) { if (sdData.alarmState == 0) {
if ((!mLatchAlarms) || if ((!mLatchAlarms) ||
(mLatchAlarms && (mLatchAlarms &&
@@ -602,6 +605,7 @@ public class SdServer extends Service implements SdDataReceiver {
startLatchTimer(); startLatchTimer();
} }
// Handle fall alarm // Handle fall alarm
Log.v(TAG,"sdData.fallAlarmStanding="+sdData.fallAlarmStanding );
if ((sdData.alarmState == 3) || (sdData.fallAlarmStanding)) { if ((sdData.alarmState == 3) || (sdData.fallAlarmStanding)) {
sdData.alarmPhrase = "FALL"; sdData.alarmPhrase = "FALL";
sdData.fallAlarmStanding = true; sdData.fallAlarmStanding = true;