-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom devices new #258
Custom devices new #258
Changes from all commits
c22d6fb
0486850
4347b35
7b95d33
442cd24
63d2c48
f20f703
d3b5f1a
3a662e4
8d55754
1a00deb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,12 @@ jobs: | |
python -m pip install --upgrade pip | ||
pip install --upgrade platformio | ||
|
||
- name: Checkout custom devices | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: MobiFlight/MobiFlight-CustomDevices | ||
path: CustomDevices | ||
|
||
- name: Run PlatformIO | ||
env: | ||
VERSION: "0.0.${{ github.event.number }}" | ||
|
@@ -43,5 +49,5 @@ jobs: | |
with: | ||
name: firmware | ||
path: | | ||
.pio/build/**/mobiflight*.hex | ||
.pio/build/**/mobiflight*.uf2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. moved to the environment within platformio.ini to differ between plane mobilflight firmwares and supporter/user firmwares in the name |
||
.pio/build/**/*.hex | ||
.pio/build/**/*.uf2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,12 @@ jobs: | |
python -m pip install --upgrade pip | ||
pip install --upgrade platformio | ||
|
||
- name: Checkout custom devices | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: MobiFlight/MobiFlight-CustomDevices | ||
path: CustomDevices | ||
|
||
- name: Extract build version | ||
id: get_version | ||
uses: battila7/get-version-action@v2 | ||
|
@@ -46,14 +52,14 @@ jobs: | |
with: | ||
name: firmware | ||
path: | | ||
.pio/build/**/mobiflight*.hex | ||
.pio/build/**/mobiflight*.uf2 | ||
.pio/build/**/*.hex | ||
.pio/build/**/*.uf2 | ||
|
||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
files: | | ||
.pio/build/**/mobiflight*.hex | ||
.pio/build/**/mobiflight*.uf2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. copy all .hex and .uf2 files to the zip folder, not only these with mobiflight* |
||
.pio/build/**/*.hex | ||
.pio/build/**/*.uf2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
.vscode/launch.json | ||
.vscode/ipch | ||
.vscode/arduino.json | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the folder CustomDevice gets cloned during building. To have no changes shown this folder is excluded from synchronization |
||
.CustomDevices |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,9 @@ | |
#define MF_MUX_SUPPORT 1 | ||
#define MF_DIGIN_MUX_SUPPORT 1 | ||
#endif | ||
#ifndef MF_CUSTOMDEVICE_SUPPORT | ||
#define MF_CUSTOMDEVICE_SUPPORT 1 | ||
#endif | ||
|
||
#ifndef MAX_OUTPUTS | ||
#define MAX_OUTPUTS 40 | ||
|
@@ -69,6 +72,9 @@ | |
#ifndef MAX_DIGIN_MUX | ||
#define MAX_DIGIN_MUX 4 | ||
#endif | ||
#ifndef MAX_CUSTOM_DEVICES | ||
#define MAX_CUSTOM_DEVICES 5 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We screwed up when adding shifters because we did output first and just called them "shifter". Then when I came and added input shifters they got called "inputshifter". Let's not make the same mistake again with custom devices and get it right the first time. Call them CUSTOM_OUTPUT_DEVICES and make sure all the relevant files are called "CustomOutputDevice". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I second that, good point. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needed some time to think about. I am still not convinced that it's required to rename it (in contrast to the shifters). The user can setup a custom device as input device, output device or both (how to name in this case). In the end it is a custom devices and the code defines what it is. From the firmware side mainly only a handler is missing which gets called if a defined action is ececuted. For the connector it's function (input and/or output) could be marked in the accordingly device.json file. |
||
#endif | ||
|
||
#ifndef MOBIFLIGHT_TYPE | ||
#define MOBIFLIGHT_TYPE "MobiFlight Mega" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,10 +63,9 @@ | |
#ifndef MAX_DIGIN_MUX | ||
#define MAX_DIGIN_MUX 4 | ||
#endif | ||
|
||
#define STEPS 64 | ||
#define STEPPER_SPEED 400 // 300 already worked, 467, too? | ||
#define STEPPER_ACCEL 800 | ||
#ifndef MAX_CUSTOM_DEVICES | ||
#define MAX_CUSTOM_DEVICES 5 | ||
#endif | ||
|
||
#ifndef MOBIFLIGHT_TYPE | ||
#define MOBIFLIGHT_TYPE "MobiFlight RaspiPico" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For all boards the custom devices is added, but excluded in build process for the existing environments |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import os | ||
|
||
Import("env") | ||
|
||
CUSTOMDEVICES_DIR = env.subst("$PROJECT_DIR/CustomDevices") | ||
|
||
if not os.path.exists(CUSTOMDEVICES_DIR): | ||
print ("Cloning Mobiflight-CustomDevices repo ... ") | ||
env.Execute("git clone --depth 100 https://github.com/MobiFlight/MobiFlight-CustomDevices $PROJECT_DIR/CustomDevices") | ||
else: | ||
print ("Checking for Mobiflight-CustomDevices repo updates ... ") | ||
env.Execute("git --work-tree=$PROJECT_DIR/CustomDevices --git-dir=$PROJECT_DIR/CustomDevices/.git pull origin main --depth 100") |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,4 @@ | |
]) | ||
|
||
# Set the output filename to the name of the board and the version | ||
env.Replace(PROGNAME=f'mobiflight_{env["PIOENV"]}_{firmware_version.replace(".", "_")}') | ||
env.Replace(PROGNAME=f'{env["PIOENV"]}_{firmware_version.replace(".", "_")}') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As now firmware names should start with the supporter/user name, |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,14 @@ | |
; development use VSCode to change the target to a non-default | ||
; by clicking on the target name in the bottom status bar. | ||
[platformio] | ||
; include custom environments to be build | ||
extra_configs = | ||
./CustomDevices/KAV_Simulation/EFIS_FCU/EFIS_FCU_platformio.ini | ||
./CustomDevices/Mobiflight/GNC255/GNC255_platformio.ini | ||
./CustomDevices/Mobiflight/TM1637/TM1637_platformio.ini | ||
./CustomDevices/Mobiflight/GenericI2C/GenericI2C_platformio.ini | ||
./CustomDevices/_all_CustomDevices/all_devices_platformio.ini | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include builts from external files which are part of the custom device repo and cloned. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are any of these actually going to ship with the main mobiflight firmware? If so, where is the build step that clones them? |
||
; Common build settings across all devices | ||
[env] | ||
|
@@ -48,20 +56,23 @@ build_flags = | |
-I./src/MF_Modules | ||
build_src_filter = | ||
+<*> | ||
-<./MF_CustomDevice> | ||
extra_scripts = | ||
pre:get_version.py | ||
pre:get_CustomDevices.py | ||
|
||
; Build settings for the Arduino Mega | ||
[env:mega] | ||
[env:mobiflight_mega] | ||
platform = atmelavr | ||
board = megaatmega2560 | ||
framework = arduino | ||
build_flags = | ||
${env.build_flags} | ||
-DMF_CUSTOMDEVICE_SUPPORT=0 | ||
'-DMOBIFLIGHT_TYPE="MobiFlight Mega"' | ||
-I./_Boards/Atmel/Board_Mega | ||
build_src_filter = | ||
${env.build_src_filter} | ||
+<../_Boards/Atmel> | ||
lib_deps = | ||
${env.lib_deps} | ||
${env.custom_lib_deps_Atmel} | ||
|
@@ -70,16 +81,17 @@ extra_scripts = | |
${env.extra_scripts} | ||
|
||
; Build settings for the Arduino Pro Micro | ||
[env:micro] | ||
[env:mobiflight_micro] | ||
platform = atmelavr | ||
board = sparkfun_promicro16 | ||
framework = arduino | ||
build_flags = | ||
${env.build_flags} | ||
-DMF_CUSTOMDEVICE_SUPPORT=0 | ||
'-DMOBIFLIGHT_TYPE="MobiFlight Micro"' | ||
-I./_Boards/Atmel/Board_ProMicro | ||
build_src_filter = | ||
${env.build_src_filter} | ||
+<../_Boards/Atmel> | ||
lib_deps = | ||
${env.lib_deps} | ||
${env.custom_lib_deps_Atmel} | ||
|
@@ -89,16 +101,17 @@ extra_scripts = | |
|
||
|
||
; Build settings for the Arduino Uno | ||
[env:uno] | ||
[env:mobiflight_uno] | ||
platform = atmelavr | ||
board = uno | ||
framework = arduino | ||
build_flags = | ||
${env.build_flags} | ||
-DMF_CUSTOMDEVICE_SUPPORT=0 | ||
'-DMOBIFLIGHT_TYPE="MobiFlight Uno"' | ||
-I./_Boards/Atmel/Board_Uno | ||
build_src_filter = | ||
${env.build_src_filter} | ||
+<../_Boards/Atmel> | ||
lib_deps = | ||
${env.lib_deps} | ||
${env.custom_lib_deps_Atmel} | ||
|
@@ -107,16 +120,17 @@ extra_scripts = | |
${env.extra_scripts} | ||
|
||
; Build settings for the Arduino Nano | ||
[env:nano] | ||
[env:mobiflight_nano] | ||
platform = atmelavr | ||
board = nanoatmega328 | ||
framework = arduino | ||
build_flags = | ||
${env.build_flags} | ||
-DMF_CUSTOMDEVICE_SUPPORT=0 | ||
'-DMOBIFLIGHT_TYPE="MobiFlight Nano"' | ||
-I./_Boards/Atmel/Board_Nano | ||
build_src_filter = | ||
${env.build_src_filter} | ||
+<../_Boards/Atmel> | ||
lib_deps = | ||
${env.lib_deps} | ||
${env.custom_lib_deps_Atmel} | ||
|
@@ -125,25 +139,24 @@ extra_scripts = | |
${env.extra_scripts} | ||
|
||
; Build settings for the Raspberry Pico original | ||
[env:raspberrypico] | ||
[env:mobiflight_raspberrypico] | ||
platform = https://github.com/maxgerhardt/platform-raspberrypi.git | ||
board = pico | ||
framework = arduino | ||
board_build.core = earlephilhower ; select new core | ||
board_build.filesystem_size = 0M ; configure filesystem size. Default 0 Mbyte. | ||
board_build.core = earlephilhower ; select new core | ||
board_build.filesystem_size = 0M ; configure filesystem size. Default 0 Mbyte. | ||
lib_ldf_mode = chain+ | ||
upload_protocol = mbed ; for debugging upoading can be changed to picoprobe | ||
;debug_tool = picoprobe ; and uncomment this for debugging w/ picoprobe | ||
upload_protocol = mbed ; for debugging upoading can be changed to picoprobe | ||
;debug_tool = picoprobe ; and uncomment this for debugging w/ picoprobe | ||
build_flags = | ||
${env.build_flags} | ||
-DUSE_INTERRUPT | ||
-DMF_CUSTOMDEVICE_SUPPORT=0 | ||
'-DMOBIFLIGHT_TYPE="MobiFlight RaspiPico"' | ||
-I./_Boards/RaspberryPi/Pico | ||
-fpermissive | ||
build_src_filter = | ||
${env.build_src_filter} | ||
+<../_Boards/RaspberryPi> | ||
lib_deps = | ||
${env.lib_deps} | ||
monitor_speed = 115200 | ||
extra_scripts = | ||
${env.extra_scripts} | ||
${env.extra_scripts} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,9 @@ | |
#if MF_DIGIN_MUX_SUPPORT == 1 | ||
#include "DigInMux.h" | ||
#endif | ||
#if MF_CUSTOMDEVICE_SUPPORT == 1 | ||
#include "CustomDevice.h" | ||
#endif | ||
|
||
CmdMessenger cmdMessenger = CmdMessenger(Serial); | ||
unsigned long lastCommand; | ||
|
@@ -83,6 +86,10 @@ void attachCommandCallbacks() | |
cmdMessenger.attach(kSetShiftRegisterPins, OutputShifter::OnSet); | ||
#endif | ||
|
||
#if MF_CUSTOMDEVICE_SUPPORT == 1 | ||
cmdMessenger.attach(kSetCustomDevice, CustomDevice::OnSet); | ||
#endif | ||
|
||
#ifdef DEBUG2CMDMESSENGER | ||
cmdMessenger.sendCmd(kDebug, F("Attached callbacks")); | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. new callback for custom devices |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree... we should not do this and use the platform.io feature for including additional dependencies