Lil' Blackbox

Coding => v2.0 => Topic started by: hakcenter on August 14, 2016, 08:11:06 PM

Title: Android development
Post by: hakcenter on August 14, 2016, 08:11:06 PM
Just thought I would make a thread to show progress.

I've got a simple app working so far on my phone, I'll build the serial interface next weekend hopefully.

Android 6.0.1+ and permissions wow. Cyanogenmod (which I'm using) does not follow the standard permissions.. Also the app needs location coarse, just to scan with bluetooth (not to connect) and you can't use the android default stuff on cm. It literally just breaks and crashes...

Instead just try to access location once, get the permission pop-up and accept always. Then phone no break.

Anyways..  Lol
Title: Re: Android development
Post by: Rx7man on August 16, 2016, 01:58:11 PM
Good job.. I haven't gotten into Android dev yet.. it may happen at some point
Title: Re: Android development
Post by: hakcenter on August 16, 2016, 02:02:37 PM
Let me tell you, its great and sucks at the same time
Title: Re: Android development
Post by: hakcenter on August 16, 2016, 03:50:41 PM
Time to start building the basic interface..

I can communicate, and parse info from the Bluetooth connection so a serial interface shouldn't be too difficult to setup on the weekend.

Things are going well, I'm trying to beautify portions, like buttons and clicks and dialogs, even a spinner in the bar while connected.


Then the difficult task of making this thing remember the bluetooth mac you last connected to, auto connect to it without crashing lol
Title: Re: Android development
Post by: hakcenter on August 19, 2016, 03:45:07 PM
Things are going pretty good, android still not the funnest thing to program for.

Been able to work on some communique today and talk directly to the LBB as far as curves and rpm points (requires the LBB to on 1.3.0e+)

Hopefully I can start making auto connect / disconnect depending if the app is open. I'm thinking of making a side on/off button that shows its connected at the actionbar, but the UI coding is a real pain in the ass.


It was funny today.. I was thinking, dang it sure would be nice to know if bluetooth is connected... and I totally forgot I connected the paired BT led to ADC5... so you CAN know if the bluetooth is connected lol!

Made it a ton easier, so startup output isn't gigantic and requiring so much garbage collection before communicating.

Hopefully I can record my android screen and talk, highlighting the work so far.
Title: Re: Android development
Post by: hakcenter on August 21, 2016, 07:34:21 PM
More screen shots. I'm pretty happy with everything.

If anyone has access to lower android machines like 4.0 / 4.1 / 4.4.2 / 5.0

Let me know, I'd like to put it on real devices and see if it crashes anywhere before I try to put it on Google play. (yes I can emulate but that really..  Doesn't help)
Title: Re: Android development
Post by: hakcenter on August 23, 2016, 08:10:58 PM
For those with android devices, I could use a lot of feedback even if you don't have the device. I need to know potential crashes, startup issues.. etc..

Even trying to connect to the wrong BT device.. lots of stuff

Join the alpha testing @ https://play.google.com/apps/testing/com.devnull.lbb
Title: Re: Android development
Post by: hakcenter on August 28, 2016, 06:32:45 PM
So this is still working pretty good. I've tracked down the last real big hiccup, apparently on bluetooth disconnect, is a global. So when my phone disconnects from the radio, or the radio decides to be weird, it would randomly disconnect my app.

Setup app to only close out the connection when the bluetooth disconnection only comes from the connected device (that took quite a bit to figure out) no more random disconnects!

Data thread is properly stopped while refreshing / setting the tuning page. Need to setup a communique for storing values in the LBB eeprom and commit values, and it is pretty much good to go.


It sure is nice, just whipping out the phone and testing different curve settings or just logging values.
Title: Re: Android development
Post by: Rx7man on August 31, 2016, 12:46:27 AM
I just downloaded android studio, but it wants to download 300mb more crap (SDK's etc) and I can't do it from home.. grumbles..
Title: Re: Android development
Post by: hakcenter on August 31, 2016, 07:47:30 AM
Haven't tried the studio on my phone, it worked okay on my Nexus 7 with OTG cable
Title: Re: Android development
Post by: hakcenter on September 04, 2016, 03:18:55 PM
EEPROM coding added, :) so close to a release on this thing
Title: Re: Android development
Post by: hakcenter on September 04, 2016, 08:53:33 PM
So here's what I got.

It's rock solid. Preferences for auto connecting / refreshing data / keeping the screen on while connected.

Tuning your current curve, I'm not going to setup pragmatically changing curves on the fly, it seems like a waste of time when you can adjust the current curve on the fly. Only thing left is to add 'default' values so in case it gets all wonky. You can commit the values to the units eeprom, and it will save between startups..  :o

Logging, is to be determined at this point.. probably some kind of cvs file or something.

Bluetooth settings work great, open it up, find your device, pair it. If you're on older android versions you may need to pair through the standard BT interface (works fine on my cm13 phone though)

Can't get to BT settings while connected, connecting to device from any screen (cause it is in the bar) pushes you right to the main screen no matter what. Only after all the garbage has been collected off the bluetooth buffer (there can be a lot if you manually reboot your unit from the switch, without key on/off scenarios)
Title: Re: Android development
Post by: Rx7man on September 05, 2016, 12:50:16 AM
Nice... at some point I'll work on something like that.. If I ever get the R-Pi hooked up it'll have one screen and the phone can do double duty with other displays.. would be kinda cool.. it's a LONG ways off
Title: Re: Android development
Post by: hakcenter on November 17, 2016, 11:17:09 AM
Man I love that I made this app, tuning has never been easier. I've got a few more booleans to setup and then sit on it for awhile trying to figure out if logging is even necessary.
Title: Re: Android development
Post by: hakcenter on June 28, 2018, 11:19:44 AM
I know it's been awhile, but I'll be rolling an update out probably tomorrow, tightening up stability and adding a new option for bulk data communication. Your LBB will need to updated with the newer serial code to make that option work, but it's a ton faster for data turn around.
Title: Re: Android development
Post by: hakcenter on October 26, 2018, 03:15:28 PM
The android app was updated today, twice actually :)

It includes the new bulk data transfers, and should be pretty robust.. I haven't had a sync issue in over 2 hours with it just sitting on my phone spamming.
The screen keep on option, is respected all the time now, and should work without the app needing to be restarted. It'll drop the screen on, if you're still connected to the LBB but the application isn't in the foreground (but it still updates screen data).

I'm going to try to tackle an IDE swap over today and then start to get data logging going
Title: Re: Android development
Post by: hakcenter on November 07, 2018, 06:34:19 PM
I wanted to just give an update to whoever reads this thread anyways.

I've been slaving over the application, and updating the lbb code, to really go hand in hand the last week. It's been absolutely apparent that bluetooth communication has it's serious limitations, and making programmatic timeouts are just not feasible.

I can get round trips of code ranging from 40ms all the way to 140ms, with the devices right next to each other. That's when I know how many bytes to expect, so best case 0 latency wait. It would also be a terrible idea to make the application wait up to 150ms between sends and receives, it would just be so slow and laggy and pointless. But now a timeout of 2-3s actually works and shuts down the connections properly, etc etc etc. All around just 100% better than using buffers and either getting old data, or waiting for new data, then jamming up and breaking.

What that means realistically is that a code upgrade is going to be absolutely mandatory. So I'll basically just force over the bulk data anyways, and it's insanely fast. Absolutely no reason to not use it.

Graphing is in, it's looking pretty good so far. Once I get the app and LBB code stable I'll push out the updates and really hone in on graphing, then log saving / possibly review.. however I think csv viewing via google sheets, is probably the most ideal. Maybe automatic data graphing can be built into sheet creation /shrug

Anyways thanks for all your patience.
Title: Re: Android development
Post by: Rx7man on November 10, 2018, 09:44:21 PM
I'm reading!.. doesn't apply to me but I still enjoy it
Title: Re: Android development
Post by: hakcenter on November 13, 2018, 11:45:59 AM
Here's the latest screens, I'll figure out how to get the icon back.

Just waiting for a ton of driving so I can tell if everything is stable. It's all built with compat now, so it should basically work on every device that is ICS is later. I need to work on the bluetooth section, so it'll update the bt info every time it's shown. A bit problematic if you had the app open, and then paired later, or changed pairing information at all after it was open. ¯\_(ツ)_/¯

I've also done a monumental amount of code optimizations now, and reigning everything in for a full release.
Title: Re: Android development
Post by: hakcenter on November 20, 2018, 01:44:06 PM
Okay so this is basically ready to go. I'm going to drive around on it for another week before letting the update rip.. but  it's basically all good to go.
Title: Re: Android development
Post by: hakcenter on January 04, 2019, 10:22:09 PM
Dang I've figured out a way to upload hex's now :D and it works!
Title: Re: Android development
Post by: hakcenter on January 18, 2019, 03:11:44 PM
firmware updating > android_app [Lil' Blackbox] (http://wiki.lilbb.com/android_app#firmware_update)

So it'll be hex's.

I'll start uploading hex's with the source code as well now. Need to think of a easy way to distribute them maybe even through the app itself...