Skip to content
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

Improve features (+ cli) #13494

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

ledvinap
Copy link
Contributor

@ledvinap ledvinap commented Apr 3, 2024

Description in commits.

654b658 needs some discussion:

  • is it OK to change feature responses (set/reset/unavailable)?
  • is AlreadyDisabled / AlreadyEnabled usefull?
  • feature list returns all known features. Maybe return only features that are available in firmware? Or mark unavailable ones (!GPS)?

Petr Ledvina added 4 commits April 3, 2024 13:19
Use designated initializers for used features. NULL values are stored
in gaps.
Use ARRAYLEN() for featureNames iteration
Use `unsigned` for bitmasks
bitmask of features that are supported in current build
configuration. Copied from init.c sanitization
featuresSupportedByBuild makes things much easier
- refuse all features that are not compiled in
- AlreadyDisabled/AlreadyEnabled info
- refuse operation if multiple features match
Copy link

github-actions bot commented Apr 3, 2024

Do you want to test this code? You can flash it directly from Betaflight Configurator:

  • Simply put #13494 (this pull request number) in the Select commit field of the Configurator firmware flasher tab (you need to Enable expert mode, Show release candidates and Development).

WARNING: It may be unstable. Use only for testing!

src/main/cli/cli.c Outdated Show resolved Hide resolved
@blckmn
Copy link
Member

blckmn commented Apr 9, 2024

the command feature list might be worth adding some params - or simply return all, including unavailable as you indicated.

@haslinghuis
Copy link
Member

In case of unavailable might have to split in all features - with a list of unavailable features on a second row.

@ledvinap
Copy link
Contributor Author

the command feature list might be worth adding some params - or simply return all, including unavailable as you indicated.

Problem is that it needs more parsing of cmdline - lot of code with minimum gain.

Currently all are returned, for backward compatibility. New commit splits features on two lines, each with header (even code parsing 'Available:' shall work, with limited feature list

@ledvinap
Copy link
Contributor Author

ledvinap commented Apr 10, 2024

When this PR is open - is it worth supporting feature softserial telem -led_st -osd 3d ( = multiple enable.disable in single command)?

@blckmn
Copy link
Member

blckmn commented May 7, 2024

When this PR is open - is it worth supporting feature softserial telem -led_st -osd 3d ( = multiple enable.disable in single command)?

this would make the diff and dump interesting... I like the idea, but it might be more complicated than the potential value it would deliver.

@nerdCopter
Copy link
Member

nerdCopter commented May 10, 2024

a4cded977 bare-minimum testing:
https://build.betaflight.com/api/builds/9ed43bba544fdfa398274c9e207cc175/json

  • show features
  • feature list
  • modified features
  • show features again
  • set unavailable
# diff all

# version
# Betaflight / STM32F405 (S405) 4.5.0 May 10 2024 / 19:00:12 (a4cded977) MSP API: 1.46
# config rev: 39d434c

# start the command batch
batch start

# reset configuration to default settings
defaults nosave

board_name FOXEERF405
manufacturer_id FOXE
mcu_id 0042004f4e48500920303452
signature 

# feature
feature TELEMETRY
feature LED_STRIP
feature OSD

# master
set acc_calibration = -11,13,80,1
set osd_canvas_height = 13

profile 0

profile 1

profile 2

profile 3

# restore original profile selection
profile 0

rateprofile 0

rateprofile 1

rateprofile 2

rateprofile 3

# restore original rateprofile selection
rateprofile 0

# save configuration
save
# feature
Enabled:  RX_SERIAL TELEMETRY LED_STRIP OSD AIRMODE ANTI_GRAVITY

# feature list
Available:  INFLIGHT_ACC_CAL RX_SERIAL MOTOR_STOP SOFTSERIAL GPS TELEMETRY 3D RSSI_ADC LED_STRIP OSD AIRMODE ESC_SENSOR ANTI_GRAVITY
NotSupported: RX_PPM SERVO_TILT RANGEFINDER RX_PARALLEL_PWM DISPLAY CHANNEL_FORWARDING TRANSPONDER RX_SPI

# feature ESC_SENSOR
Enabled ESC_SENSOR

# feature -LED_STRIP
Disabled LED_STRIP

# feature
Enabled:  RX_SERIAL TELEMETRY OSD AIRMODE ESC_SENSOR ANTI_GRAVITY

# feature RANGEFINDER
Unavailable RANGEFINDER

src/main/cli/cli.c Outdated Show resolved Hide resolved
@nerdCopter
Copy link
Member

@ledvinap , i do not mind listing unsupported in feature list as you have done. if the ! is used, then such might not be human-readable.

also, maybe feature should output the same as feature list and no need for the extra word list 🤷‍♂️

@SteveCEvans
Copy link
Member

The available list is in the configurator. I think it best if the firmware only reports on the features built into it.

@haslinghuis
Copy link
Member

@ledvinap please rebase

Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants