App GpioShutdownService for C2

InspecteurGadget
Posts: 94
Joined: Thu Apr 27, 2017 3:33 am
languages_spoken: French, English
ODROIDs: Odroid C2
USB GPS, Bluetooth, Wifi
Emmc 8g Android M
Rtc modue
Has thanked: 0
Been thanked: 1 time
Contact:

Re: App GpioShutdownService for C2

Unread post by InspecteurGadget » Wed Jun 13, 2018 2:19 pm

Yes I use torque with tasker : tasker open an app when I exceed 3000rpm.
And I use tasker with screen filter: tasker applied I night filter at 8P.M.

But if tasker work with your app we can add a button to any spot.

For the moment your application works in the material direction towards software (button to action volume for example).

But the best would be in the software to hardware direction(at a certain time, it performs the lighting of the inner light for example).

Edit: with tasker it exist an AutoArduino plugin, that communicate with arduino on usb or wifi or ethernet, we should make an identical plugin to communicate with our gpio

joerg
Posts: 890
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: App GpioShutdownService for C2

Unread post by joerg » Thu Jun 14, 2018 6:51 am

Sorry, I made a mistake in my last post. I was thinking 'tasker' but I wrote 'torque'. So I mean with tasker you can program receiving intents. When I am back at home and find some free time I can check this and give some example.
http://tasker.dinglisch.net/userguide/en/intents.html

InspecteurGadget
Posts: 94
Joined: Thu Apr 27, 2017 3:33 am
languages_spoken: French, English
ODROIDs: Odroid C2
USB GPS, Bluetooth, Wifi
Emmc 8g Android M
Rtc modue
Has thanked: 0
Been thanked: 1 time
Contact:

Re: App GpioShutdownService for C2

Unread post by InspecteurGadget » Thu Jun 14, 2018 2:54 pm

do not worry, my english is not very good.
If I find solutions I'll give you

InspecteurGadget
Posts: 94
Joined: Thu Apr 27, 2017 3:33 am
languages_spoken: French, English
ODROIDs: Odroid C2
USB GPS, Bluetooth, Wifi
Emmc 8g Android M
Rtc modue
Has thanked: 0
Been thanked: 1 time
Contact:

Re: App GpioShutdownService for C2

Unread post by InspecteurGadget » Fri Jun 15, 2018 12:07 am

Hi with androidmanifest.XML of your app we can send intent with tasker

joerg
Posts: 890
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: App GpioShutdownService for C2

Unread post by joerg » Fri Jun 15, 2018 7:59 pm

OK, I would need to extend my app for receiving intents. So far it only receives intent for system shutdown and for boot complete. I could do but it would take some time.
And to test sending intents from my app to tasker I need to understand how to add a receiving intent in tasker and the syntax of it. Yesterday I looked into it but without success so far.

joerg
Posts: 890
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: App GpioShutdownService for C2

Unread post by joerg » Mon Jun 18, 2018 7:51 pm

There is now a new version uploaded in first post.
I added the functionality to send and receive intents. You can adjust tasker to work with this intents.
GpioShutdownService sends the status of the used inputs in this form:
com.jw.shutdownservice.GpioShutdownService.GPIO_STATE_CHANGED
with extra data:
int gpio, int value
Every state change from 0 to 1 or from 1 to 0 is sent.
In the ExtraXAction the gpio number must be set, the action string can be left empty. The zero is not allowed as gpio number.

To receive with tasker add a event system:intent received under Profiles:
screen_event_receive_gpio.png
screen_event_receive_gpio.png (35.57 KiB) Viewed 3025 times
And a Task to make something with it:
screen_task_popup.png
screen_task_popup.png (39.02 KiB) Viewed 3025 times
Generates a pop up:
screen_gpio_status_changed.png
screen_gpio_status_changed.png (22.55 KiB) Viewed 3025 times
All of the not used gpio can be set with tasker. The Action must be in this form:
com.jw.shutdownservice.action.SET_GPIO
with extra data:
int gpio, int value

To send the intent with tasker add a task system:send intent and put the above string as Action, under first Extra gpio:22, under second Extra value:1
Allowed values are 0 and 1.
screen_action_set_gpio.png
screen_action_set_gpio.png (33.86 KiB) Viewed 3025 times

InspecteurGadget
Posts: 94
Joined: Thu Apr 27, 2017 3:33 am
languages_spoken: French, English
ODROIDs: Odroid C2
USB GPS, Bluetooth, Wifi
Emmc 8g Android M
Rtc modue
Has thanked: 0
Been thanked: 1 time
Contact:

Re: App GpioShutdownService for C2

Unread post by InspecteurGadget » Tue Jun 19, 2018 1:41 pm

Oh yes nickel thank's to you Joeg =)

InspecteurGadget
Posts: 94
Joined: Thu Apr 27, 2017 3:33 am
languages_spoken: French, English
ODROIDs: Odroid C2
USB GPS, Bluetooth, Wifi
Emmc 8g Android M
Rtc modue
Has thanked: 0
Been thanked: 1 time
Contact:

Re: App GpioShutdownService for C2

Unread post by InspecteurGadget » Tue Jun 19, 2018 10:12 pm

Hi,
I test intent received,
Exactly like your 2 firts picture
I d'ont have popup

joerg
Posts: 890
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: App GpioShutdownService for C2

Unread post by joerg » Wed Jun 20, 2018 1:37 pm

Have you got checked Preferences:Misc:Alow External Access ?

InspecteurGadget
Posts: 94
Joined: Thu Apr 27, 2017 3:33 am
languages_spoken: French, English
ODROIDs: Odroid C2
USB GPS, Bluetooth, Wifi
Emmc 8g Android M
Rtc modue
Has thanked: 0
Been thanked: 1 time
Contact:

Re: App GpioShutdownService for C2

Unread post by InspecteurGadget » Wed Jun 20, 2018 6:45 pm

Yes I check it
How can I test gpio to be sure Im not burn it? I've a multimeter

joerg
Posts: 890
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: App GpioShutdownService for C2

Unread post by joerg » Thu Jun 21, 2018 12:47 am

Hi, you would see a message in logcat as this, when the intent is sent:

Code: Select all

com.jw.shutdownservice D/com.jw.gpioshutdown: Intent { act=com.jw.shutdownservice.GpioShutdownService.GPIO_STATE_CHANGED (has extras) }
The intent is sent when the gpio input changes from 1 to 0 or from 0 to 1.

Code: Select all

adb shell logcat|grep shutdownservice
And you always should use a resistor of 1k or 2k to connect the gpio to GND. Only to be sure not to burn the gpio.

InspecteurGadget
Posts: 94
Joined: Thu Apr 27, 2017 3:33 am
languages_spoken: French, English
ODROIDs: Odroid C2
USB GPS, Bluetooth, Wifi
Emmc 8g Android M
Rtc modue
Has thanked: 0
Been thanked: 1 time
Contact:

Re: App GpioShutdownService for C2

Unread post by InspecteurGadget » Fri Jun 22, 2018 5:21 pm

Hi,
It work :)
I thinks its my relay board that not compatible with 3.3v .

I bought one this week

juanitomaille
Posts: 34
Joined: Thu Dec 21, 2017 12:25 am
languages_spoken: english, french
ODROIDs: XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: App GpioShutdownService for C2

Unread post by juanitomaille » Sun Nov 04, 2018 10:11 pm

Hi @joerg,

I've seen in another thraed that you were interrested by rotary encoder.

Do you think it's possible to integrate this function to your app ?

thanks

joerg
Posts: 890
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: App GpioShutdownService for C2

Unread post by joerg » Sun Nov 04, 2018 11:48 pm

Sorry juanitomaille, maybe one day. But for now I am busy with other things.

User avatar
odroid
Site Admin
Posts: 31760
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 83 times
Been thanked: 241 times
Contact:

Re: App GpioShutdownService for C2

Unread post by odroid » Mon Nov 05, 2018 9:14 am

This wiki page must be a good starting point.
https://wiki.odroid.com/odroid-c2/appli ... on_android

buffalodropkick
Posts: 4
Joined: Wed Feb 13, 2019 12:01 pm
languages_spoken: english
ODROIDs: C2 XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: App GpioShutdownService for C2

Unread post by buffalodropkick » Wed Feb 13, 2019 12:03 pm

[The extension apk has been deactivated and can no longer be displayed.]
@joerg is this apk no longer available?

joerg
Posts: 890
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: App GpioShutdownService for C2

Unread post by joerg » Thu Feb 14, 2019 4:23 am

No, I think since the new version of this forum apk files cannot be uploaded. I uploaded the last version as zip instead.

buffalodropkick
Posts: 4
Joined: Wed Feb 13, 2019 12:01 pm
languages_spoken: english
ODROIDs: C2 XU4
Has thanked: 0
Been thanked: 0
Contact:

Re: App GpioShutdownService for C2

Unread post by buffalodropkick » Sat Feb 16, 2019 12:17 pm

joerg wrote:
Thu Feb 14, 2019 4:23 am
No, I think since the new version of this forum apk files cannot be uploaded. I uploaded the last version as zip instead.
Fantastic, thank you - can't wait to test it out!

mranderson
Posts: 9
Joined: Fri Jul 08, 2016 6:28 am
languages_spoken: english
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: App GpioShutdownService for C2

Unread post by mranderson » Mon Jun 03, 2019 6:45 pm

Do I still need to go through the ordeal of recompiling the DTS file to get the GPIO working in the latest android marshmellow?

joerg
Posts: 890
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: App GpioShutdownService for C2

Unread post by joerg » Mon Jun 03, 2019 10:45 pm

It should work without recompiling.

mranderson
Posts: 9
Joined: Fri Jul 08, 2016 6:28 am
languages_spoken: english
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: App GpioShutdownService for C2

Unread post by mranderson » Tue Jun 04, 2019 4:37 pm

oh that would be great Joerg, I only need a shutdown button, so I thought I'd change the shutdown to 214, but when I connect the wires as a test nothing seems to happen. Thanks again for all your sharing here, it's still a few levels too high for me with all the transistors

joerg
Posts: 890
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: App GpioShutdownService for C2

Unread post by joerg » Wed Jun 05, 2019 3:28 am

Oh, you need to give the wiringpi number, means 24, not 214.
Pls refer to the wiki page: https://wiki.odroid.com/odroid-c2/hardw ... connectors

mranderson
Posts: 9
Joined: Fri Jul 08, 2016 6:28 am
languages_spoken: english
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: App GpioShutdownService for C2

Unread post by mranderson » Wed Jun 05, 2019 5:44 am

I used pin 24 and a ground wire, also I made sure in your app the shutdown referred to pin 24

joerg
Posts: 890
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: App GpioShutdownService for C2

Unread post by joerg » Thu Jun 06, 2019 12:50 am

Hi @mranderson, it would be helpful, if you show the output of a logcat|grep shutdownservice here. To do this, please open a adb terminal and restart the service. The service is restarted if you press the upper left back (<) button on the settings.
And please check also, if you gave root permission and in settings/apps, if you gave all permissions.

mranderson
Posts: 9
Joined: Fri Jul 08, 2016 6:28 am
languages_spoken: english
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: App GpioShutdownService for C2

Unread post by mranderson » Fri Jun 07, 2019 4:24 am

hi Joerg, i'm not sure what the difference is now, it suddenly worked after I connected with the adb. But it does shut off immediately, it doesn't look like the typical powerdown when you push the onscreen menu. It's correct that I don't see the dialog of android saying shutting down?

joerg
Posts: 890
Joined: Tue Apr 01, 2014 2:14 am
languages_spoken: german, english, español
ODROIDs: C1, C1+, C2
Location: Germany
Has thanked: 5 times
Been thanked: 13 times
Contact:

Re: App GpioShutdownService for C2

Unread post by joerg » Fri Jun 07, 2019 4:30 pm

Fine that it works now. And yes, there is no dialog to when shutdown is send. If you really need a dialog, you can use the Extra Action as this:
Extra1 Pin = 24
Extra1 Action = input keyevent --longpress KEYCODE_POWER
In that case you would need to delete the 24 in Shutdown Pin.

mranderson
Posts: 9
Joined: Fri Jul 08, 2016 6:28 am
languages_spoken: english
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: App GpioShutdownService for C2

Unread post by mranderson » Fri Jun 07, 2019 5:24 pm

actually the change is that I set the delay time to 1 ( I saw in logcat it was working but delay was too long), thanks so much for your help!

Post Reply

Return to “Android”

Who is online

Users browsing this forum: No registered users and 0 guests