Saving a Trigger Ride Session

Good time.

A long time ago you explained to me that in order for the odometer data and other information about the current trip to be recorded in ROM, you must exit the application. I have been doing this for several years.
But it would be much more convenient to program the trigger for a specific condition, so that, upon the occurrence, the data is written to memory.
Is it possible from the trigger to record the current trip data, in particular the odometer and tripmeter, without exiting RealDash?

You should always shutdown the system gracefully. If you just pull the plug, at some point your operating system will get corrupted for sure. Its not only RealDash, but any process in your OS; if you pull the plug while file write operation is in progress the files can get corrupted. Its just matter of time. That is the reason why you need to shutdown RealDash properly to avoid such situations.

Yes. but if I need to go again in 5 minutes, I will not turn off the system completely. That is why periodic saves are required, as in a real dashboard.
You’ve probably studied the order of forming the power supply of the factory panels.
The session is saved if the ignition is turned off!

My request is caused by a problem on which it is problematic to return to the application if it has been completed. I need to start RealDash again by rebooting the USB SERIAL connection, which is not always practical!
Maybe we can somehow still record the odometer at least from turning off the ignition, as in the standard panels. After all, turning off the ignition always means the end of the trip.

No, ‘real dashboards’ don’t do periodic saves. Instead their variables are stored in EEPROM style resident memory. Unfortunately we do not have that sort of memory available on devices where RealDash typically runs.

Adding new Action as ‘Save session state’ would be pretty simple, I can do that. Use it at your own risk. if device loses power while write operation is in progress, RealDash will not start anymore. Also, while saving the screen update performance will suffer.

I’m ready to put up with it! I ask you to do it!
Can I connect this input from the ignition?
P.S. My Android turns off only after the ignition is turned off and it has been at least 2 minutes.

Perhaps a save when the tablet is put to sleep? I know my setup will almost never completely power down the Android device. Instead, I trigger it by wake/sleep commands (via hardware) when the ignition is turned on and off.

I decided against making an action for this. Its just too easy to make a trigger that will fire constantly on every frame. Then, if that trigger is associated with an action that makes file operations it will create a havoc. I just do not want to be troubleshooting corrupted files and poor performance because of this.

What other events would be a good place to save the data?

  • Ignition On input changes to 0?
  • Data connection is disconnected?
  • ?

Can you provide me with these commands? Waking up and sleeping?

Yes, these inputs. And usb is disabled I think enough!

What does ‘sleeping’ mean in Android? Turning off the screen?

I will soon upload 1.8.1-beta2, which will save the state in following events:

  • RealDash loses focus (this has been on previous versions)
  • Android activity onPause is called.
  • Charger is disconnected.
  • USB is disconnected.
  • Headset is disconnected.
  • ‘Body Electronics->Ignition On’ input changes from 1 to 0.

Would this be sufficient to cover most cases?

Yes. Turn off the screen and go to energy saving, like everywhere else! But as far as I understand, you asked that for a reason? So I could be wrong about something! Right?

I am directly triggering the on/off/sleep button via transistor from an Arduino. This is not strictly a software solution, although I have heard of some people using methods that include sensing when the tablet/Android device is being charged (indicating the ignition is on), or running on battery. I have been using a variety of Android SBCs, and am now moving on with a VIM3, which has pads on the board for the on/off/sleep button. From there, I use an Arduino to interface to the car, and that provides the logic level trigger.

I was trying to figure out what kind of an event an Android app gets when it enters into the sleep mode, as standard Android devices do not have a specific sleep mode, but a standby instead (screen off).

The 1.8.1-BETA2 has been uploaded to store. It saves the state within android app ‘onPause’, which I suspect will be called when entering sleep mode. On screen off it seems to be called on all my test devices.