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

Spektrum SRXL2 implementation #5791

Merged
merged 1 commit into from
Oct 23, 2020

Conversation

MiguelFAlvarez
Copy link
Contributor

This PR includes support for Spektrum SRXL2. This is based off the betaflight PR betaflight/betaflight#8598 but there are a lot more changes here as some of the other spektrum features required did not yet exist in inav.

As opposed to the betaflight PR which uses the UART Idle interrupt, this code polls the idle flag in the rcFrameStatusFn as requested.

This PR also depends on #5757 which at this time has been approved, but not yet merged. Until it is merged, compile checks won't pass.

@stronnag
Copy link
Collaborator

stronnag commented May 30, 2020

There are still some issues with this patch series (#5757 and #5791 patches applied to current dev branch):

  • Compiler warnings due to prototypes of foo() vice foo(void)
  • No Makefile patches, so linking fails
$ make TARGET=MATEKF722 BUILD_PREFIX=srxl2-1
settings.yaml -> settings_generated.h, settings_generated.c 
%% (normal) -O2 ./src/main/target/MATEKF722/target.c 
%% (normal) -O2 ./src/main/main.c 
%% (normal) -O2 ./src/main/target/common_hardware.c 
%% (normal) -O2 ./src/main/build/assert.c 
%% (normal) -O2 ./src/main/build/build_config.c 
%% (normal) -O2 ./src/main/build/debug.c 
%% (normal) -O2 ./src/main/build/version.c 
%% (normal) -O2 ./src/main/common/calibration.c 
%% (normal) -O2 ./src/main/common/encoding.c 
%% (normal) -O2 ./src/main/common/filter.c 
%% (normal) -O2 ./src/main/common/gps_conversion.c 
%% (normal) -O2 ./src/main/common/log.c 
%% (normal) -O2 ./src/main/common/logic_condition.c 
%% (normal) -O2 ./src/main/common/global_functions.c 
%% (normal) -O2 ./src/main/common/global_variables.c 
%% (normal) -O2 ./src/main/common/maths.c 
%% (normal) -O2 ./src/main/common/memory.c 
%% (normal) -O2 ./src/main/common/printf.c 
%% (normal) -O2 ./src/main/common/time.c 
%% (normal) -O2 ./src/main/common/typeconversion.c 
%% (normal) -O2 ./src/main/config/config_eeprom.c 
%% (normal) -O2 ./src/main/config/config_streamer.c 
%% (normal) -O2 ./src/main/config/feature.c 
%% (normal) -O2 ./src/main/config/parameter_group.c 
%% (normal) -O2 ./src/main/drivers/adc.c 
%% (normal) -O2 ./src/main/drivers/bus.c 
%% (normal) -O2 ./src/main/drivers/bus_busdev_i2c.c 
%% (normal) -O2 ./src/main/drivers/bus_busdev_spi.c 
%% (normal) -O2 ./src/main/drivers/bus_i2c_soft.c 
%% (normal) -O2 ./src/main/drivers/display.c 
%% (normal) -O2 ./src/main/drivers/exti.c 
%% (normal) -O2 ./src/main/drivers/io.c 
%% (normal) -O2 ./src/main/drivers/io_pca9685.c 
%% (normal) -O2 ./src/main/drivers/irlock.c 
%% (normal) -O2 ./src/main/drivers/light_led.c 
%% (normal) -O2 ./src/main/drivers/persistent.c 
%% (normal) -O2 ./src/main/drivers/rx_nrf24l01.c 
%% (normal) -O2 ./src/main/drivers/rx_spi.c 
%% (normal) -O2 ./src/main/drivers/pitotmeter_adc.c 
%% (normal) -O2 ./src/main/drivers/pitotmeter_virtual.c 
%% (normal) -O2 ./src/main/drivers/pwm_esc_detect.c 
%% (normal) -O2 ./src/main/drivers/pwm_mapping.c 
%% (normal) -O2 ./src/main/drivers/pwm_output.c 
%% (normal) -O2 ./src/main/drivers/pinio.c 
%% (normal) -O2 ./src/main/drivers/rcc.c 
%% (normal) -O2 ./src/main/drivers/rx_pwm.c 
%% (normal) -O2 ./src/main/drivers/serial.c 
%% (normal) -O2 ./src/main/drivers/sound_beeper.c 
%% (normal) -O2 ./src/main/drivers/stack_check.c 
%% (normal) -O2 ./src/main/drivers/system.c 
%% (normal) -O2 ./src/main/drivers/time.c 
%% (normal) -O2 ./src/main/drivers/timer.c 
%% (normal) -O2 ./src/main/drivers/lights_io.c 
%% (normal) -O2 ./src/main/drivers/1-wire.c 
%% (normal) -O2 ./src/main/drivers/1-wire/ds2482.c 
%% (normal) -O2 ./src/main/drivers/temperature/ds18b20.c 
%% (normal) -O2 ./src/main/drivers/temperature/lm75.c 
%% (normal) -O2 ./src/main/drivers/pitotmeter_ms4525.c 
%% (normal) -O2 ./src/main/fc/cli.c 
In file included from ./src/main/fc/cli.c:105:
./src/main/rx/spektrum.h:40:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
   40 | bool srxlTelemetryBufferEmpty();
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
%% (normal) -O2 ./src/main/fc/config.c 
%% (normal) -O2 ./src/main/fc/controlrate_profile.c 
%% (normal) -O2 ./src/main/fc/fc_core.c 
%% (normal) -O2 ./src/main/fc/fc_init.c 
In file included from ./src/main/fc/fc_init.c:108:
./src/main/io/displayport_srxl.h:23:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
   23 | displayPort_t *displayPortSrxlInit();
      | ^~~~~~~~~~~~~
In file included from ./src/main/fc/fc_init.c:130:
./src/main/rx/spektrum.h:40:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
   40 | bool srxlTelemetryBufferEmpty();
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
%% (normal) -O2 ./src/main/fc/fc_tasks.c 
%% (normal) -O2 ./src/main/fc/fc_hardfaults.c 
%% (normal) -O2 ./src/main/fc/fc_msp.c 
%% (normal) -O2 ./src/main/fc/fc_msp_box.c 
%% (normal) -O2 ./src/main/fc/rc_smoothing.c 
%% (normal) -O2 ./src/main/fc/rc_adjustments.c 
%% (normal) -O2 ./src/main/fc/rc_controls.c 
%% (normal) -O2 ./src/main/fc/rc_curves.c 
%% (normal) -O2 ./src/main/fc/rc_modes.c 
%% (normal) -O2 ./src/main/fc/runtime_config.c 
%% (normal) -O2 ./src/main/fc/settings.c 
In file included from ./obj/main/MATEKF722/settings_generated.c:16,
                 from ./src/main/fc/settings.c:13:
./src/main/rx/spektrum.h:40:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
   40 | bool srxlTelemetryBufferEmpty();
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
%% (normal) -O2 ./src/main/fc/stats.c 
%% (normal) -O2 ./src/main/flight/failsafe.c 
%% (normal) -O2 ./src/main/flight/hil.c 
%% (normal) -O2 ./src/main/flight/imu.c 
%% (normal) -O2 ./src/main/flight/mixer.c 
%% (normal) -O2 ./src/main/flight/pid.c 
%% (normal) -O2 ./src/main/flight/pid_autotune.c 
%% (normal) -O2 ./src/main/flight/rth_estimator.c 
%% (normal) -O2 ./src/main/flight/servos.c 
%% (normal) -O2 ./src/main/flight/wind_estimator.c 
%% (normal) -O2 ./src/main/flight/gyroanalyse.c 
%% (normal) -O2 ./src/main/flight/rpm_filter.c 
%% (normal) -O2 ./src/main/flight/dynamic_gyro_notch.c 
%% (normal) -O2 ./src/main/io/beeper.c 
%% (normal) -O2 ./src/main/io/esc_serialshot.c 
%% (normal) -O2 ./src/main/io/servo_sbus.c 
%% (normal) -O2 ./src/main/io/frsky_osd.c 
%% (normal) -O2 ./src/main/io/osd_dji_hd.c 
%% (normal) -O2 ./src/main/io/lights.c 
%% (normal) -O2 ./src/main/io/piniobox.c 
%% (normal) -O2 ./src/main/io/pwmdriver_i2c.c 
%% (normal) -O2 ./src/main/io/serial.c 
%% (normal) -O2 ./src/main/io/serial_4way.c 
%% (normal) -O2 ./src/main/io/serial_4way_avrootloader.c 
%% (normal) -O2 ./src/main/io/serial_4way_stk500v2.c 
%% (normal) -O2 ./src/main/io/statusindicator.c 
%% (normal) -O2 ./src/main/io/rcdevice.c 
%% (normal) -O2 ./src/main/io/rcdevice_cam.c 
%% (normal) -O2 ./src/main/msp/msp_serial.c 
%% (normal) -O2 ./src/main/rx/crsf.c 
%% (normal) -O2 ./src/main/rx/eleres.c 
%% (normal) -O2 ./src/main/rx/fport.c 
%% (normal) -O2 ./src/main/rx/ibus.c 
%% (normal) -O2 ./src/main/rx/jetiexbus.c 
%% (normal) -O2 ./src/main/rx/msp.c 
%% (normal) -O2 ./src/main/rx/msp_override.c 
%% (normal) -O2 ./src/main/rx/nrf24_cx10.c 
%% (normal) -O2 ./src/main/rx/nrf24_inav.c 
%% (normal) -O2 ./src/main/rx/nrf24_h8_3d.c 
%% (normal) -O2 ./src/main/rx/nrf24_syma.c 
%% (normal) -O2 ./src/main/rx/nrf24_v202.c 
%% (normal) -O2 ./src/main/rx/pwm.c 
%% (normal) -O2 ./src/main/rx/frsky_crc.c 
%% (normal) -O2 ./src/main/rx/rx.c 
In file included from ./src/main/rx/rx.c:62:
./src/main/rx/spektrum.h:40:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
   40 | bool srxlTelemetryBufferEmpty();
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
%% (normal) -O2 ./src/main/rx/rx_spi.c 
%% (normal) -O2 ./src/main/rx/sbus.c 
%% (normal) -O2 ./src/main/rx/sbus_channels.c 
%% (normal) -O2 ./src/main/rx/spektrum.c 
In file included from ./src/main/rx/spektrum.c:47:
./src/main/rx/spektrum.h:40:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
   40 | bool srxlTelemetryBufferEmpty();
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
./src/main/rx/spektrum.c:278:5: warning: function declaration isn't a prototype [-Wstrict-prototypes]
  278 | bool srxlTelemetryBufferEmpty()
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
%% (normal) -O2 ./src/main/rx/sumd.c 
%% (normal) -O2 ./src/main/rx/sumh.c 
%% (normal) -O2 ./src/main/rx/uib_rx.c 
%% (normal) -O2 ./src/main/rx/xbus.c 
%% (normal) -O2 ./src/main/scheduler/scheduler.c 
%% (normal) -O2 ./src/main/sensors/acceleration.c 
%% (normal) -O2 ./src/main/sensors/battery.c 
%% (normal) -O2 ./src/main/sensors/boardalignment.c 
%% (normal) -O2 ./src/main/sensors/compass.c 
%% (normal) -O2 ./src/main/sensors/diagnostics.c 
%% (normal) -O2 ./src/main/sensors/gyro.c 
%% (normal) -O2 ./src/main/sensors/initialisation.c 
%% (normal) -O2 ./src/main/sensors/esc_sensor.c 
%% (normal) -O2 ./src/main/sensors/irlock.c 
%% (normal) -O2 ./src/main/sensors/temperature.c 
%% (normal) -O2 ./src/main/uav_interconnect/uav_interconnect_bus.c 
%% (normal) -O2 ./src/main/uav_interconnect/uav_interconnect_rangefinder.c 
%% (normal) -O2 ./src/main/blackbox/blackbox.c 
%% (normal) -O2 ./src/main/blackbox/blackbox_encoding.c 
%% (normal) -O2 ./src/main/blackbox/blackbox_io.c 
%% (normal) -O2 ./src/main/cms/cms.c 
%% (normal) -O2 ./src/main/cms/cms_menu_battery.c 
%% (normal) -O2 ./src/main/cms/cms_menu_blackbox.c 
%% (normal) -O2 ./src/main/cms/cms_menu_builtin.c 
%% (normal) -O2 ./src/main/cms/cms_menu_imu.c 
%% (normal) -O2 ./src/main/cms/cms_menu_ledstrip.c 
%% (normal) -O2 ./src/main/cms/cms_menu_misc.c 
%% (normal) -O2 ./src/main/cms/cms_menu_mixer_servo.c 
%% (normal) -O2 ./src/main/cms/cms_menu_navigation.c 
%% (normal) -O2 ./src/main/cms/cms_menu_osd.c 
%% (normal) -O2 ./src/main/cms/cms_menu_saveexit.c 
%% (normal) -O2 ./src/main/cms/cms_menu_vtx.c 
%% (normal) -O2 ./src/main/drivers/display_ug2864hsweg01.c 
%% (normal) -O2 ./src/main/drivers/rangefinder/rangefinder_hcsr04.c 
%% (normal) -O2 ./src/main/drivers/rangefinder/rangefinder_hcsr04_i2c.c 
%% (normal) -O2 ./src/main/drivers/rangefinder/rangefinder_srf10.c 
%% (normal) -O2 ./src/main/drivers/rangefinder/rangefinder_vl53l0x.c 
%% (normal) -O2 ./src/main/drivers/rangefinder/rangefinder_virtual.c 
%% (normal) -O2 ./src/main/drivers/opflow/opflow_fake.c 
%% (normal) -O2 ./src/main/drivers/opflow/opflow_virtual.c 
%% (normal) -O2 ./src/main/drivers/vtx_common.c 
%% (normal) -O2 ./src/main/io/rangefinder_msp.c 
%% (normal) -O2 ./src/main/io/rangefinder_benewake.c 
%% (normal) -O2 ./src/main/io/opflow_cxof.c 
%% (normal) -O2 ./src/main/io/opflow_msp.c 
%% (normal) -O2 ./src/main/io/dashboard.c 
%% (normal) -O2 ./src/main/io/displayport_frsky_osd.c 
%% (normal) -O2 ./src/main/io/displayport_max7456.c 
%% (normal) -O2 ./src/main/io/displayport_msp.c 
%% (normal) -O2 ./src/main/io/displayport_oled.c 
%% (normal) -O2 ./src/main/io/displayport_hott.c 
%% (normal) -O2 ./src/main/io/gps.c 
%% (normal) -O2 ./src/main/io/gps_ublox.c 
%% (normal) -O2 ./src/main/io/gps_nmea.c 
%% (normal) -O2 ./src/main/io/gps_naza.c 
%% (normal) -O2 ./src/main/io/ledstrip.c 
%% (normal) -O2 ./src/main/io/osd.c 
%% (normal) -O2 ./src/main/io/osd_canvas.c 
%% (normal) -O2 ./src/main/io/osd_common.c 
%% (normal) -O2 ./src/main/io/osd_grid.c 
%% (normal) -O2 ./src/main/io/osd_hud.c 
%% (normal) -O2 ./src/main/navigation/navigation.c 
%% (normal) -O2 ./src/main/navigation/navigation_fixedwing.c 
%% (normal) -O2 ./src/main/navigation/navigation_fw_launch.c 
%% (normal) -O2 ./src/main/navigation/navigation_geo.c 
%% (normal) -O2 ./src/main/navigation/navigation_multicopter.c 
%% (normal) -O2 ./src/main/navigation/navigation_pos_estimator.c 
%% (normal) -O2 ./src/main/navigation/navigation_pos_estimator_agl.c 
%% (normal) -O2 ./src/main/navigation/navigation_pos_estimator_flow.c 
%% (normal) -O2 ./src/main/navigation/navigation_rover_boat.c 
%% (normal) -O2 ./src/main/sensors/barometer.c 
%% (normal) -O2 ./src/main/sensors/pitotmeter.c 
%% (normal) -O2 ./src/main/sensors/rangefinder.c 
%% (normal) -O2 ./src/main/sensors/opflow.c 
%% (normal) -O2 ./src/main/telemetry/crsf.c 
%% (normal) -O2 ./src/main/telemetry/frsky.c 
%% (normal) -O2 ./src/main/telemetry/frsky_d.c 
%% (normal) -O2 ./src/main/telemetry/hott.c 
%% (normal) -O2 ./src/main/telemetry/ibus_shared.c 
%% (normal) -O2 ./src/main/telemetry/ibus.c 
%% (normal) -O2 ./src/main/telemetry/ltm.c 
%% (normal) -O2 ./src/main/telemetry/mavlink.c 
%% (normal) -O2 ./src/main/telemetry/msp_shared.c 
%% (normal) -O2 ./src/main/telemetry/smartport.c 
%% (normal) -O2 ./src/main/telemetry/sim.c 
%% (normal) -O2 ./src/main/telemetry/telemetry.c 
%% (normal) -O2 ./src/main/io/vtx.c 
%% (normal) -O2 ./src/main/io/vtx_string.c 
%% (normal) -O2 ./src/main/io/vtx_smartaudio.c 
%% (normal) -O2 ./src/main/io/vtx_tramp.c 
%% (normal) -O2 ./src/main/io/vtx_ffpv24g.c 
%% (normal) -O2 ./src/main/io/vtx_control.c 
%% (normal) -O2 ./src/main/drivers/accgyro/accgyro.c 
%% (normal) -O2 ./src/main/drivers/accgyro/accgyro_mpu.c 
%% (normal) -O2 ./src/main/drivers/adc_stm32f7xx.c 
%% (normal) -O2 ./src/main/drivers/bus_i2c_hal.c 
%% (normal) -O2 ./src/main/drivers/dma_stm32f7xx.c 
%% (normal) -O2 ./src/main/drivers/bus_spi_hal.c 
%% (normal) -O2 ./src/main/drivers/timer_impl_hal.c 
%% (normal) -O2 ./src/main/drivers/timer_stm32f7xx.c 
%% (normal) -O2 ./src/main/drivers/uart_inverter.c 
%% (normal) -O2 ./src/main/drivers/system_stm32f7xx.c 
%% (normal) -O2 ./src/main/drivers/serial_uart_stm32f7xx.c 
%% (normal) -O2 ./src/main/drivers/serial_softserial.c 
%% (normal) -O2 ./src/main/drivers/serial_uart_hal.c 
%% (normal) -O2 ./src/main/drivers/sdcard/sdmmc_sdio_f7xx.c 
%% (normal) -O2 ./src/main/drivers/accgyro/accgyro_mpu6500.c 
%% (normal) -O2 ./src/main/drivers/barometer/barometer_bmp085.c 
%% (normal) -O2 ./src/main/drivers/barometer/barometer_bmp280.c 
%% (normal) -O2 ./src/main/drivers/barometer/barometer_ms56xx.c 
%% (normal) -O2 ./src/main/drivers/compass/compass_hmc5883l.c 
%% (normal) -O2 ./src/main/drivers/compass/compass_qmc5883l.c 
%% (normal) -O2 ./src/main/drivers/compass/compass_ist8310.c 
%% (normal) -O2 ./src/main/drivers/compass/compass_ist8308.c 
%% (normal) -O2 ./src/main/drivers/compass/compass_mag3110.c 
%% (normal) -O2 ./src/main/drivers/compass/compass_lis3mdl.c 
%% (normal) -O2 ./src/main/drivers/light_ws2811strip.c 
%% (normal) -O2 ./src/main/drivers/max7456.c 
%% (normal) -O2 ./src/main/drivers/sdcard/sdcard.c 
%% (normal) -O2 ./src/main/drivers/sdcard/sdcard_spi.c 
%% (normal) -O2 ./src/main/drivers/sdcard/sdcard_sdio.c 
%% (normal) -O2 ./src/main/io/asyncfatfs/asyncfatfs.c 
%% (normal) -O2 ./src/main/drivers/usb_msc_f7xx.c 
%% (normal) -O2 ./src/main/msc/usbd_storage_sd_spi.c 
%% (normal) -O2 ./src/main/vcp_hal/usbd_desc.c 
%% (normal) -O2 ./src/main/vcp_hal/usbd_cdc_interface.c 
%% (normal) -O2 ./src/main/drivers/serial_usb_vcp.c 
%% (normal) -O2 ./src/main/drivers/usb_io.c 
Linking MATEKF722
/usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: /tmp/inav_MATEKF722.elf.ECoPUu.ltrans0.ltrans.o: in function `main':
/home/jrh/Projects/fc/inav/./src/main/fc/fc_init.c:569: undefined reference to `displayPortSrxlInit'
/usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: /tmp/inav_MATEKF722.elf.ECoPUu.ltrans0.ltrans.o: in function `main':
/home/jrh/Projects/fc/inav/./src/main/telemetry/telemetry.c:128: undefined reference to `initSrxlTelemetry'
/usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: /tmp/inav_MATEKF722.elf.ECoPUu.ltrans0.ltrans.o: in function `main':
/home/jrh/Projects/fc/inav/./src/main/rx/rx.c:194: undefined reference to `srxl2RxInit'
/usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: /tmp/inav_MATEKF722.elf.ECoPUu.ltrans1.ltrans.o: in function `cliRxBind':
/home/jrh/Projects/fc/inav/./src/main/fc/cli.c:2638: undefined reference to `srxl2Bind'
/usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: /tmp/inav_MATEKF722.elf.ECoPUu.ltrans3.ltrans.o: in function `taskTelemetry':
/home/jrh/Projects/fc/inav/./src/main/telemetry/telemetry.c:239: undefined reference to `handleSrxlTelemetry'
/usr/lib/gcc/arm-none-eabi/10.1.0/../../../../arm-none-eabi/bin/ld: /tmp/inav_MATEKF722.elf.ECoPUu.ltrans10.ltrans.o: in function `telemetryCheckState':
/home/jrh/Projects/fc/inav/./src/main/telemetry/telemetry.c:194: undefined reference to `checkSrxlTelemetryState'
Memory region         Used Size  Region Size  %age Used
        ITCM_RAM:       13560 B        16 KB     82.76%
      ITCM_FLASH:          0 GB        16 KB      0.00%
ITCM_FLASH_CONFIG:          0 GB        16 KB      0.00%
     ITCM_FLASH1:          0 GB       480 KB      0.00%
           FLASH:         812 B        16 KB      4.96%
    FLASH_CONFIG:          0 GB        16 KB      0.00%
          FLASH1:      469667 B       480 KB     95.55%
             TCM:       15624 B        64 KB     23.84%
             RAM:       64480 B       192 KB     32.80%
       MEMORY_B1:          0 GB         0 GB
collect2: error: ld returned 1 exit status
make: *** [Makefile:291: obj/main/inav_MATEKF722.elf] Error 1

@MiguelFAlvarez
Copy link
Contributor Author

@stronnag just made a commit that should address this. Forgot to commit the source.mk file. Also fixed the strict prototype warnings

@digitalentity
Copy link
Member

@MiguelFAlvarez can you please rebase on top of development? This should cleanly rebase/merge now

@digitalentity digitalentity changed the base branch from development to master June 8, 2020 10:14
@MiguelFAlvarez
Copy link
Contributor Author

@digitalentity I rebased on master because it looks like development was removed. Hope that's the correct one. Looks like all checks pass now!

Copy link
Member

@digitalentity digitalentity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this PR still uses RTC6705 which we don't support anymore and doesn't account for FFPV 2.4 GHz VTX.

To avoid creating more dependencies, please don't use any VTX-specific tables for power or frequency. Use generic power indexes (but note that they are VTX specific and actual power/index mapping is determined at run-time to match capabilities of the actual hardware used).

What we could consider is to add a protocol-agnostic API to convert from mW of power to VTX power index so we can do all the conversions within the VTX driver and keep control code nice and simple.

#define VTX_COMMON_BAND_RACE 5

// RTC6705 RF Power index 25 or 200 mW
#define VTX_6705_POWER_25 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6705 is not supported on INAV

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed all of the vtx code with the exception of a few placeholders blocked by USE_SPEKTRUM_VTX_CONTROL. If anything, will just make a pull request later on with support for this.

#define VTX_6705_POWER_25 1
#define VTX_6705_POWER_200 2

// SmartAudio "---", 25, 200, 500, 800 mW
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have unified frequency/power control now and number of power levels is dependent on the driver and actual VTX used. Hard coded values are not necessary.

default:
cliPrint("Not supported.");
break;
#if defined(USE_RX_FRSKY_SPI)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not supported

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed


// RF Power Index translation tables. No generic power API available.....

#ifdef USE_VTX_TRAMP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use VTX-protocol specific tables. Use unified power level API and note that power level is dependent on the driver and actual hardware connected.

src/main/io/spektrum_vtx_control.c Outdated Show resolved Hide resolved
@digitalentity digitalentity self-requested a review June 8, 2020 15:33
Copy link
Member

@digitalentity digitalentity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, otherwise LGTM

src/main/build/version.h Outdated Show resolved Hide resolved
@tourerjim
Copy link

The PR implementing SRXL2 (#5791) has not been merged into master and currently has a number of (trivial) conflicts that prevent it from being merged for 2.6. We have also not heard from the developer for a while.

I've downloaded the 2.6.0 configurator and flashed the Hex file but then no SRXL2 in serial tab, do we know when this will happen as I may need to go back to 2.5

@MiguelFAlvarez
Copy link
Contributor Author

The PR implementing SRXL2 (#5791) has not been merged into master and currently has a number of (trivial) conflicts that prevent it from being merged for 2.6. We have also not heard from the developer for a while.

I've downloaded the 2.6.0 configurator and flashed the Hex file but then no SRXL2 in serial tab, do we know when this will happen as I may need to go back to 2.5

When we left off on this, it was ready to be merged and it was just a matter of waiting for 2.6 to start coming around. Didn't realize some conflicts had arisen since then, and nobody had tried reaching out about the conflicts. I'll take a look at this later today to get them corrected.

@tourerjim
Copy link

Thank you, MiguelFAlvarez

This consists of various files/changes brought over from betaflight with modifications to operate in the current state of inav.
It also includes files/changes that were not a part of the betaflight SRXL2 merge, as the previous bidi srxl implementation was not yet implemented either, and SRXL2 has some dependencies on the Spektrum telemetry structuring from those files.
@MiguelFAlvarez
Copy link
Contributor Author

@stronnag
Just finished updating this to address the conflicts you mentioned from the other thread. The reason nobody had heard from me for a while is because this had been left ready to be merged, and I was totally unaware that new conflicts had arisen. Anyway, feel free to ping me in the future if this happens again :)

@stronnag
Copy link
Collaborator

Thanks for fixing the merge issues. There is no "conflict monitor"; we all have to watch our own PRs prior to merge.

Anyway, as this feature already has approval, I'm going to merge it.

@MiguelFAlvarez, would you please also consider (separate PR), adding some basic documentation (To Rx.md / Telemetry.md as appropriate), e.g. any connection requirements (RX/TX pin(s)) and how to enable telemetry / telemetry data available; as you think appropriate.

@stronnag stronnag merged commit a88bab5 into iNavFlight:master Oct 23, 2020
@stronnag stronnag added the Release Notes Add this when a PR needs to be mentioned in the release notes label Oct 23, 2020
@MiguelFAlvarez
Copy link
Contributor Author

I had been checking on the PR every few days, but mainly just to make sure it ended up getting merged lol. Was unaware that merge conflicts would not notify me. Good to know for future requests that I'll have to pay special attention to that.

And yeah I'll look into getting a quick doc added. Will probably throw in the same notes I had from my temporary releases.

@stronnag
Copy link
Collaborator

Thanks.
And if anyone wants to test this in 2.6, then it's now included in the NEXT stash hex files.

@tourerjim
Copy link

Thanks I will flash the Hex files tomorrow.

@FrankPetrilli
Copy link

FrankPetrilli commented Nov 12, 2020

Thanks all for your contributions!

I've attempted to use SRXL2 in iNav today, and I'm running into some issues getting it to work. Running the NEXT build, I'm left with all channels at SRXL2_CHANNEL_CENTER no matter what changes are made to srxl2_unit_id or srxl2_baud_fast.

I'm using a Spektrum SPM4650 connected to TX2 of a Matek F405-SE with a Spektrum DX6i controller. This configuration works perfectly in Betaflight, so hardware configuration is unlikely the cause.

I built a version from HEAD with debug messages added back in and sent through the MSP connection. With that enabled, I see a loop every 250ms of case ListenForHandshake: switching to 115200 baud. Toggling the DX6i on and off, moving sticks, all result in nothing either in the CLI or in the "Receiver" view.

I also tried out pulling the modified 3.5.0 branch of https://github.com/MiguelFAlvarez/inav and merging in support of the DPS310 barometer on my F405-SE. In this configuration, SRXL2 still did not work.

I'm happy to make any changes y'all think would get this going - there's bad weather the next few days, so no reason to run Betaflight for now. :)

@tourerjim
Copy link

Connect to RX2 my works fine

@MiguelFAlvarez
Copy link
Contributor Author

@FrankPetrilli it looks like TX2 on that FC is used for smartport, and therefore will have a hardware inverter which breaks compatibility with SRXL2. Please try a different uart TX pin.

@FrankPetrilli
Copy link

Interesting, thanks all! I was able to get it to work by finding a hybrid approach. :)

@tourerjim RX2 did not work - same results as TX2
@MiguelFAlvarez I'm not so sure that TX2 is inverted, but I gave it a shot, and TX4 worked great! Your comment reminded me of something else I saw on Matek's site - TX2 is used by default in iNav as Softserial. I built a version from HEAD with DEF_TIM(TIM5, CH3, PA2, TIM_USE_ANY, 0, 0), //TX2 softserial1_Tx commented out and now TX2 works for Spektrum.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release Notes Add this when a PR needs to be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants