threeme3 / usdx

Simple and experimental (class-E driven) SSB transceiver.
616 stars 221 forks source link

Split out ino file into multi files #28

Open howard0su opened 3 years ago

howard0su commented 3 years ago

It is inconvenient to maintain such big file. Also this limit us to build the different firmware for the different board by default. I would suggest to do the following folder structure to organize the code instead:

src/*.h -> the main source code. We can split the code into multi .h files like cat.h, radio.h, menu.h, globals.h, lcd1602.h, si5351.h, led.h, debug.h QCX-SSB/QCX-SSB.ino -> the build folder to build QCX-SSB firmware. This ino contains the definition and a serial of includes to include the files in src/ uSDX/uSDX.ino -> the build folder to build uSDX firmware. uSDX_ABC/uSDX_ABC.ino -> another build for another board.

Thoughts?

tonious commented 3 years ago

I really like this idea. I was tempted to open a PR for this myself.

tonious commented 3 years ago

Although a smaller scale might be easier to start; break out the LCD logic into lcd.cpp / lcd.h, menu into menu.cpp / menu.h. There will probably still be quite a bit of preprocessor work involved.

howard0su commented 3 years ago

lcd may need several files for different lcd option like 1602 and LED.

krzysztof9nowak commented 3 years ago

Hello, I would like to contribute to the project. I think we can use solutions already proven in a big and popular Arduino project - Marlin 3D Printer Firmware. They are using PlatformIO, which allows for developing in a real IDE like VS Code, while still keeping the reverse compatibility with a simple Arduino IDE.

Regarding compiling for different boards, a well thought out system of header files, each providing a configuration for one type of board might be better than having multiple .ino entry points.

jokubasver commented 2 years ago

Hello, I would like to contribute to the project. I think we can use solutions already proven in a big and popular Arduino project - Marlin 3D Printer Firmware. They are using PlatformIO, which allows for developing in a real IDE like VS Code, while still keeping the reverse compatibility with a simple Arduino IDE.

Regarding compiling for different boards, a well thought out system of header files, each providing a configuration for one type of board might be better than having multiple .ino entry points.

PlatformIO is a great idea, I find it much more convenient and easier to use than Arduino IDE. And I see that you have it split out the project into multiple files: https://github.com/krzysztof9nowak/QCX-SSB/tree/feature-platformio

I haven't tried it, but I assume it works fine.

This could be a good starting point for Guido to implement this into his repo.

W3JDR commented 2 years ago

I'd like to suggest that the functions related to the receiver DSP processing be seperated out. This way, someone who wants to build a variant with a different processor can do it. I think the TX stuff should be separated too, as I see the present approach as a laboratory curiosity that has limited applicability, even though it is quite clever. Joe