-
Notifications
You must be signed in to change notification settings - Fork 0
How to set up a custom device
First of all, it is assumed that you have properbly installed PlatformIO under VSCode. If not, it is the right time to do this. Next clone the firmware reposority and create a new branch for your custom device. Follow the next steps carefully!
- A new folder under
/CustomDevicesis required. The foldername should be your (company)Name. This helps to have a better overview between multiple custom device from different users. - Copy the
_templatefolder into your newly created folder from step 1 and rename this folder to your device name. - Rename
MyCustomClass.cppandMyCustomClass.hto a name which fits to your custom device. - Rename
MyCustomDevice_platformio.inito a name which fits to your custom device (see step 3) but keep_platformio.ini, e.g.YourChangedName_platformio.ini - Change the include path's from
MyCustomClass.cpp,MFCustomDevice.handMFCustomDevice.cppfrom#include MyCustomClass.hto#include YourChangedName.h - Adapt the
YourChangedName_platformio.ini:
- Decide which board should be supported. The _template is set up for the Mega and Pico. Is one of them is not needed, delete this part which is called in the following environment.
- rename each required environment from
[env:mobiflight_template_mega]to your custom device. It should be like[env:YourName_YourCustomDevice_board] - change
-I./CustomDevices/_templateunderbuild_flagsto your choosed folder name for all environments. - change
+<../CustomDevices/_template>underbuild_src_filterto your choosed folder name for all environments. - change
'-DMOBIFLIGHT_TYPE="Mobiflight Template Mega"'to your needs. It should be like'-DMOBIFLIGHT_TYPE="YourName_YourDevice_board"'. This is important and this must match with "MobiFlightType" within the .json files (see below)
- Adapt the
platformio.ini:
- add your
YourChangedName_platformio.iniunderextra_configs =with the complete path, like./CustomDevices/YourFolderName/YourDeviceNameFolder/YourChangedName_platformio.ini
Now it's time to test all these settings. Open a teminal window in PlatformIO and type pio run. This will compile all environments defined in platformio.ini including your newly defined environments. If everything is setup correct, no failure should be reported.
To get your new defined board recognized from the connector, for each supported board a board.json file has to be set up. Within the copied folder is a sub folder named connector_files. Rename both board.json files to your needs. It should be like YourName_YourDevice_board.board.json. Both files (or just one if only one board should be supported) must be modified:
- change
"FirmwareBaseName": "mobiflight_template_raspberrypico"to your defined environment, see point 6. - change
"FriendlyName": "Mobiflight Template Mega"-> ERKLÄRUNG - change
"MobiFlightType": "Mobiflight Template Mega"-> ERKLÄRUNG siehe oben - change
"CustomDeviceType": ["MOBIFLIGHT_TEMPLATE","MOBIFLIGHT_TEMPLATE"]-> ERKLÄRUNG
es fehlt noch ERKLÄRUNG device.json
Copy the xy.board.json files to the /Boards folder and the xy.device.json files to /Devices. Both folders are subfolders from your Mobiflight installation.
Copy firmware from .pio/build/YourEnvironmentName/YourEnvironmentName_0_0_1.hex or/and .uf2 to /firmware folder. You can do a right click on the .hex or .uf2 file and choose "Reveal in File Explorer" to open the folder within the file explorer.
Test flashing and definition of custom devices within the connector.