Friday, November 20, 2015

Another Bluetooth Button Control Scheme

My post on adding button control to my Digital Dash project (http://mikesgeneralblog.blogspot.com/2015/08/physical-controls-for-digital-dash.html) has turned out to be one of the most popular ones that I've written. (Around here that only means about 550 views, but it's something.)  It's been linked to in a couple of places and over on the AutoApps forum someone asked me if there was a way to make a button continually perform a task as long as it was held down.  It turned out to be pretty easy, so here's an example that controls the Media Volume of a device.

I chose to use the "Media Rewind" keycode to lower the system's media volume because it made sense in the physical layout of the Bluetooth Gamepad I was using, but you can, of course, use any key you want. To make a companion way to increase the volume, just copy the profiles and tasks and rename them with "Up" instead of "Down" in the names and change the "-1" in line A1 of the first task to a "+1". You'll also need to modify the IF clause in line A3 so that it checks for a maximum value rather than a minimum.

Profile: Vo!umeDownStart (437)
Event: AutoInput Key [ Configuration:Keys: Media Rewind
Key Action: Key Down ]
Enter: VolDown (436)
A1: Media Volume [ Level:%VOLM-1 Display:Off Sound:Off ]
A2: Wait [ MS:250 Seconds:0 Minutes:0 Hours:0 Days:0 ]
A3: Goto [ Type:Action Number Number:1 Label: ] If [ %VOLM > 0 ]

Profile: VolumeDownStop (438)
Priority: 11
Event: AutoInput Key [ Configuration:Keys: Media Rewind
Key Action: Key Up ]
Enter: VolDownStop (439)
A1: Stop [ With Error:Off Task:VolDown ]

A couple of things to note: The first profile triggers on the Key Down event and the second one triggers on Key Up. Be sure you bump up the priority for launched tasks in the second profile; it needs to be greater than the the task it's trying to stop. You'll also need to run AutoInput's KeySupress function before you use these profiles and then disable key suppression when you're done. The 250 ms delay in line A2 seems to give a nice response ramp, but if you want something a little faster, just decrease that value.  Finally, you'll probably need to disable "Restore Settings" in the first profile to make the volume changes stick.

Hope this helps someone.

Wednesday, November 18, 2015

Another (Very) Minor Tweak

I have a control on the main screen that allows me to toggle the tablet's AutoBrightness on and off, but it doesn't get used very much.  99% of the time we're driving in the sun with the top down and I want the tablet at full brightness.  About the only time I use it is on those rare occasions  when we are traveling at night.

It occurred to me today, though, that if I do dim the screen on the tablet, the phone will remain at full brightness.  That would be annoying and since I don't really have a control interface on that unit, changing the brightness would be distracting and annoying, requiring me to go into settings and fumble around.

I don't really want to put controls on the phone, so instead I used AutoRemote.  Now when I toggle the screen brightness on the tablet, it sends a direct message to the phone, which causes it to toggle as well.

As I said, a very minor thing, but when I need to use it, it will be handy.

Wednesday, November 11, 2015

Torque and Tasker

If you're interested in getting data from the Torque app into Tasker, take a look at the video I posted on YouTube:

https://www.youtube.com/watch?v=bjFLbbYakBo

It begins by showing you how to set up Torque, then steps through gathering the information and tools that you need, and finishes up with some actual Tasker code.