arduino

More
01 Oct 2015 09:21 #38306 by ppisljar
arduino was created by ppisljar
Hi,

i am working on arduino project for controlling toy RC models directly from computer. I don't want to port the protocols of deviationTX but rather make my code compatible with them. This way i dont need to constantly maintain the project, and if i add more protocol support this can directly benefit deviationTX project as well.

I have a prototype version working, but its far from perfect. i still need to do some modifications to the protocol code to make it work.

my idea is to have an arduino project where i can just copy in whole protocols folder from devtx. i was hoping i will be able to just include protocol.c ... but no luck for now.

Right now i have to create header file for each of the protocol files (lets say for v202_nrf24l01.c i have to create v202_nrf24l01.h, so i can include it in my arduino project. trying to include .c file directly didn't work. I think the reason is the way this is supposed to work on deviationTX. if i understand correctly protocols are compiled separately and are loaded dynamicaly at a run time ? i am not sure this is a good solution for my project (except if i would be loading protocols over serial communication).

i also need to rename all .c files to .cpp (the way arduino IDE works ... .c files are compiled using C99 mode ... )

then i need to modify each file and comment out all subdirectory inclusions. arduino IDE cannot work with files in subdirectories it seems. so #include <config/tx.h> will fail. I am not sure if this can be fixed on my side, but on devTX side it could help me if there was a two layer include. so #include "config.h" in all the files ... and then in config.h you include <config/tx.h> ... this way i only would need to replace the config.h file.

for all the other #includes i have "fake" files which mostly do nothing (music.h for example). i only implemented the timers and SPI.

the only two files i remove from the protocol folder are protocol.h and protocol.c
protocol.h could probably be useful, to load the list of supported protocols, but the problem is i still need to inlcude the correct .h files (which i need to generate).

if this cannot be worked around i am thinking of making a script, which would do all the necesary modifications to the devtx protocol folder:
- remove protocol.c
- overwrite music.h, mixer.h, telemetry.h with blanks
- overwrite common.h and add common.cpp (from my project)
- rename all .c files to .cpp
- go thru files and comment out subfolder includes (like config/tx.h)
- generate new protocol.h (which would define the protocols availible (from protocol.h in devtx) and include the correct .h files)


what are your toughts on this ?

Please Log in or Create an account to join the conversation.

More
01 Oct 2015 19:53 #38325 by mwm
Replied by mwm on topic arduino
The protocols don't have to be compiled into separate modules and loaded in RAM; that's a kludge used to get around the limited flash in the Devo 7E. On all the other Tx's, it's compiled in directly.

Which arduino board are you using, and what's your toolchain? There might be a better alternative like the arduino-mk package.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

More
02 Oct 2015 06:44 #38342 by ppisljar
Replied by ppisljar on topic arduino
Arduino UNO board with Arduino IDE.

Please Log in or Create an account to join the conversation.

More
02 Oct 2015 14:47 #38357 by mwm
Replied by mwm on topic arduino
I'd consider moving to the arduino-mk package, which may solve the issues about include file ordering and having to rename the files for the ide. I haven't tried using C files, but I know my biggest problem is that the IDE uses default gcc flags that that make the compiler a lot more forgiving, so I typically have to fix code that comes from the IDE. That shouldn't be a problem in your case.

Do not ask me questions via PM. Ask in the forums, where I'll answer if I can.

My remotely piloted vehicle ("drone") is a yacht.

Please Log in or Create an account to join the conversation.

Time to create page: 0.046 seconds
Powered by Kunena Forum