Skip to content

Commit

Permalink
Merge pull request #34 from MobileRoboticsSkoltech/remote_fixes
Browse files Browse the repository at this point in the history
Remote feature fixes
  • Loading branch information
azaat authored Jul 6, 2021
2 parents c2724ac + a1769a3 commit 8fbac93
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ before_install:
- openssl aes-256-cbc -K $encrypted_9e5ce9a0670f_key -iv $encrypted_9e5ce9a0670f_iv -in opencamera-extended-firebase-adminsdk-yv5yz-e33a8ce5c1.json.enc -out ./opencamera-extended-firebase-adminsdk-yv5yz-e33a8ce5c1.json -d
- openssl aes-256-cbc -K $encrypted_cec398169802_key -iv $encrypted_cec398169802_iv -in my-release-key.keystore.enc -out ./my-release-key.keystore -d
- yes | sdkmanager "platforms;android-28"
- curl -L https://packagecloud.io/github/git-lfs/gpgkey | sudo apt-key add -

cache:
directories:
- "$HOME/google-cloud-sdk/"

before_script:
- python3.6 --version
- export CLOUDSDK_PYTHON=$(which python3.6)
- gcloud version || true
- export CLOUDSDK_CORE_DISABLE_PROMPTS=1
- if [ ! -d "$HOME/google-cloud-sdk/bin" ]; then rm -rf $HOME/google-cloud-sdk; curl https://sdk.cloud.google.com | bash; fi
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ OpenCamera Sensors is an Android application for synchronized recording of video

OpenCamera Sensors is an Android application for synchronized recording of video and IMU data. It records IMU data and video with frame timestamps synced to the same clock.


This project is based on [Open Camera](https://opencamera.org.uk/) — a popular open-source camera application with flexibility in camera parameters settings, actively supported by the community. By regular merging of Open Camera updates our app will adapt to new smartphones and APIs — this is an advantage over the other video + IMU recording applications built from scratch for Camera2API.

## Usage
Expand Down
12 changes: 10 additions & 2 deletions app/src/main/java/net/sourceforge/opencamera/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,15 @@ private void onCreateInner(Bundle savedInstanceState) {
if( MyDebug.LOG )
Log.d(TAG, "onCreate: time after setting default preference values: " + (System.currentTimeMillis() - debug_time));

// Enable all sensors on startup
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor prefEditor = sharedPreferences.edit();
prefEditor.putBoolean(PreferenceKeys.AccelPreferenceKey, true);
prefEditor.putBoolean(PreferenceKeys.GyroPreferenceKey, true);
prefEditor.putBoolean(PreferenceKeys.MagnetometerPrefKey, true);
prefEditor.apply();


if( getIntent() != null && getIntent().getExtras() != null ) {
// whether called from testing
is_test = getIntent().getExtras().getBoolean("test_project");
Expand All @@ -283,7 +292,6 @@ private void onCreateInner(Bundle savedInstanceState) {
if( MyDebug.LOG )
Log.d(TAG, "shortcut: " + getIntent().getAction());
}
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

// determine whether we should support "auto stabilise" feature
// risk of running out of memory on lower end devices, due to manipulation of large bitmaps
Expand Down Expand Up @@ -365,7 +373,7 @@ private void onCreateInner(Bundle savedInstanceState) {
mainUI.closeExposureUI();

// set up the camera and its preview
preview = new Preview(applicationInterface, ((ViewGroup) this.findViewById(R.id.preview)));
preview = new Preview(applicationInterface, this.findViewById(R.id.preview));
if( MyDebug.LOG )
Log.d(TAG, "onCreate: time after creating preview: " + (System.currentTimeMillis() - debug_time));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package net.sourceforge.opencamera.sensorremote;

import android.content.SharedPreferences;
import android.hardware.Sensor;
import android.preference.PreferenceManager;
import android.util.Log;

import net.sourceforge.opencamera.ExtendedAppInterface;
import net.sourceforge.opencamera.MainActivity;
import net.sourceforge.opencamera.MyDebug;
import net.sourceforge.opencamera.PreferenceKeys;
import net.sourceforge.opencamera.preview.Preview;
import net.sourceforge.opencamera.sensorlogging.RawSensorInfo;
import net.sourceforge.opencamera.sensorlogging.VideoPhaseInfo;
Expand Down Expand Up @@ -70,12 +67,12 @@ RemoteRpcResponse handleImuRequest(long durationMillis, boolean wantAccel, boole
if (mRawSensorInfo != null && !mRawSensorInfo.isRecording()) {
// TODO: custom rates?
Callable<Void> recStartCallable = () -> {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
SharedPreferences.Editor prefEditor = sharedPreferences.edit();
prefEditor.putBoolean(PreferenceKeys.AccelPreferenceKey, wantAccel);
prefEditor.putBoolean(PreferenceKeys.GyroPreferenceKey, wantGyro);
prefEditor.putBoolean(PreferenceKeys.MagnetometerPrefKey, wantMagnetic);
prefEditor.apply();
// SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(mContext);
// SharedPreferences.Editor prefEditor = sharedPreferences.edit();
// prefEditor.putBoolean(PreferenceKeys.AccelPreferenceKey, wantAccel);
// prefEditor.putBoolean(PreferenceKeys.GyroPreferenceKey, wantGyro);
// prefEditor.putBoolean(PreferenceKeys.MagnetometerPrefKey, wantMagnetic);
// prefEditor.apply();

Date currentDate = new Date();
mContext.getApplicationInterface().startImu(wantAccel, wantGyro, wantMagnetic, currentDate);
Expand Down

0 comments on commit 8fbac93

Please sign in to comment.