Author |
Topic  |
sundancer
Pulcino

Czech Republic
41 Posts |
Posted - 17/03/2015 : 12:58:12
|
Helo I got stucked on IO problem. The task I am trying to do is to make a special build for my home made instrument (KOBO + arduino board). I want to implement special sound alarms. My idea is to modify PlayResource function in sound.cpp to send special string code to Kobo com port (this is already in device setup). The external device will then play the sound.
Can anyone give me some hint about this?
I read that there is IRC chanel, but there is noone. Is there also a skype channel? Are there some developers active? |
|
Coolwind
Moderator
    
Italy
8957 Posts |
Posted - 26/03/2015 : 01:47:05
|
What kind of hints do you need ? As you say, you need to change the sound function, and nothing else is needed. It depends on how your hardware is seen by linux. I hope you dont need to develop a device driver yourself, that's not something related strictly to LK..
|
 |
|
sundancer
Pulcino

Czech Republic
41 Posts |
Posted - 26/03/2015 : 10:53:14
|
I need to: Access com port which is set in the device setting and send string to the device. Thats all. |
 |
|
brunotl
Pterodattilo
    
France
1154 Posts |
Posted - 26/03/2015 : 11:07:33
|
find "d->Com->WriteString" and you will found lot of exemple ...
|
 |
|
jaaaaf
Pulcino

France
81 Posts |
Posted - 26/03/2015 : 11:50:48
|
Well, in fact I'm actually doing exactly the same thing for the GoFlyV4! I discuss with Bruno, and the correct and clean way to do it is to make a new driver. With this method, you change nothing on LK, just add a driver than can be use for the devices who want it. I'm actually blocked because Jarek who manage the GoFLy is not available for now, and it seems the GoFly doesn't understand the NMEA sentences I sent to the device. But the mechanism is ok and seems to works. I think the definitive sentences we will choose for the Gofly, will be to send the name of the sound file. So if you choose to implement the same sentences in your arduino board, you can use the GoFly driver I make, without doing anything! I can make public my actual development branch for that if you are interested. I still have some work to do on it, but you can have a good idea on how it works, and make some tests. |
Jack, competition paragliding pilot _LK8000 on V2, V3, V4, ..._ |
 |
|
sundancer
Pulcino

Czech Republic
41 Posts |
Posted - 26/03/2015 : 12:46:12
|
Making a driver is a nice idea, but I really dont to make my device dependent on GOFLY code. I will make my device for my frineds and they will surely want to have version updates. If there are uncompatible changes in your driver, I will have to repair it for them.
The other way I was thinking is the XCI events. There is direct possibility to post event = SendNMEAPort1 ANYDATA But I dont know if there is an airspace warning. But this would be a very nice solution (but I dont know if this works for LK8000. It works for xcsoar)
If you share the code I will be glad. |
 |
|
jaaaaf
Pulcino

France
81 Posts |
Posted - 26/03/2015 : 12:51:20
|
Yes you can make another device for you, based on the gofly one. There will be very few code to make. I will check if my code is still usable, and I will share it.
I tell you here when it's done. Hope I can do it today. |
Jack, competition paragliding pilot _LK8000 on V2, V3, V4, ..._ |
 |
|
jaaaaf
Pulcino

France
81 Posts |
Posted - 26/03/2015 : 13:37:34
|
Check this commit: https://github.com/jaaaaf/LK8000/commit/638c0fe9742ecbaac0257ee5565c66a6e0b6a73c Hope it works, I'm not very strong with git...
You just have to do the same thing as devGoFlyV4.cpp and devGoFlyV4.h, and implement as you want the method : DevGoFlyV4::SendAlarm(PDeviceDescriptor_t d, int alarmId ) |
Jack, competition paragliding pilot _LK8000 on V2, V3, V4, ..._ |
 |
|
Coolwind
Moderator
    
Italy
8957 Posts |
Posted - 26/03/2015 : 17:32:19
|
Can you provide an example of what you need to send to the device through the com port? Because if it is something short, you dont need to do anything special through com ports, you simply access the device itself from the code.
If I am not wrong, all you want is to write something like GPFALARM,1 to the device. The easy way: open the device and write to it, then close it. To make it async, write to a named pipe, or to a message queue, and have a separate standalone (out of LK) little program that read the pipe or message queue and writes to device.
The most complicated way: create a device in LK for a simple operation like that.. The device name can be a link to the real one, so even if you change real device, the link is always available.
Where is the problem to do so?
|
Edited by - Coolwind on 26/03/2015 17:37:51 |
 |
|
jaaaaf
Pulcino

France
81 Posts |
Posted - 27/03/2015 : 22:17:38
|
Yes, you can do like Coolwind said. But you need to put your code everywhere you want to write sounds.
If you want to do it in my way, I update my code in a most complete commit here: https://github.com/jaaaaf/LK8000/commit/86cdb5b2a0741ccdbab9f02b0fb9e5367a3488aa (come modifications was missing to works in the last commit I made)
Still not working for now on my GoFly, but nmea strings are sent. |
Jack, competition paragliding pilot _LK8000 on V2, V3, V4, ..._ |
 |
|
Coolwind
Moderator
    
Italy
8957 Posts |
Posted - 27/03/2015 : 22:51:29
|
you too have to change the code if you want to use more than 1 sound (GFPALARM,1) . For me it is a complicated way of doing a simple work, but for fun anything is possible of course.
|
 |
|
brunotl
Pterodattilo
    
France
1154 Posts |
Posted - 28/03/2015 : 15:12:54
|
i think way used by jaaaf, is the best for avoid side effect.
|
 |
|
parapenT1sta
Pterodattilo
    
Portugal
1864 Posts |
Posted - 28/03/2015 : 15:17:29
|
Bruno, can you merge the Jaaaf code to your branch? I think a lot pilots with V4 would like to test it. |
 |
|
jaaaaf
Pulcino

France
81 Posts |
Posted - 28/03/2015 : 15:19:47
|
It's not a good idea to take it now like this. For now it doesn't work on my device, and it's not finished! Actually all sounds will be the same (if there is any sounds). |
Jack, competition paragliding pilot _LK8000 on V2, V3, V4, ..._ |
 |
|
Coolwind
Moderator
    
Italy
8957 Posts |
Posted - 28/03/2015 : 16:33:58
|
Exactly. And I am quite curious to know how you are going to make different sound in the source code without changing it. I have already told what was the correct approach to do this, and not to create a device in LK for a simple playsound, so I wait to see what comes next. |
 |
|
jaaaaf
Pulcino

France
81 Posts |
Posted - 29/03/2015 : 11:44:45
|
Coolwind, it's easy, like I said before, just implement the method DevGoFlyV4::SendAlarm(PDeviceDescriptor_t d, int alarmId ) You can make a conversion table, or you can just send the alarm id you receive, if your sending device know how to interpret it. With the conversion table, you can make a conversion for sound you really want to be different, and default sounds for others.
This method has also the advantage to have only one build for different devices receiving NMEA sentences. You just have to change the device used on LK config, on your device.
|
Jack, competition paragliding pilot _LK8000 on V2, V3, V4, ..._ |
 |
|
Topic  |
|