Merge branch 'master' into fixDefaultModeAltitude

This commit is contained in:
Filipp Bakanov 2022-01-28 14:06:00 +03:00
commit 3670b7d410
No known key found for this signature in database
GPG Key ID: A8B7CC1737CDF1D2
12 changed files with 257 additions and 137 deletions

View File

@ -1,21 +0,0 @@
---
name: Feature Request
about: Suggest an idea for for a new feature for Betaflight
labels: "Template: Feature Request"
---
<!-- This is a template that you must fill. If not, the message will be closed. So don't erase any subtitle in this template (they start with ###)
and complete all of them -->
<!-- Please note that feature requests are not 'fire and forget'. It is a lot more likely that the feature you would like to have will be implemented if you keep watching your feature request, and provide more details to developers looking into implementing your feature, and help them with testing. -->
### Is your feature request related to a problem? Please describe.
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
### Describe the solution you'd like
<!-- A clear and concise description of what you want to happen. -->
### Describe alternatives you've considered
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
<!-- Add any other context or screenshots about the feature request that you think might be relevant here. -->

View File

@ -0,0 +1,36 @@
name: Feature Request
description: Suggest an idea for for a new feature for Betaflight.
labels: [Template: Feature Request]
body:
- type: markdown
attributes:
value: |
**Please note that feature requests are not 'fire and forget'.**
It is a lot more likely that the feature you would like to have will be implemented if you keep watching your feature request, and provide more details to developers looking into implementing your feature, and help them with testing.
- type: textarea
attributes:
label: Is your feature request related to a problem? Please describe
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...].
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
validations:
required: true
- type: textarea
attributes:
label: Other information
description: Add any other context or screenshots about the feature request that you think might be relevant here.

View File

@ -1,37 +0,0 @@
---
name: Firmware Bug Report
about: Create a report to help us fix bugs in the Betaflight firmware
labels: "Template: Bug"
---
<!-- This is a template that you must fill. If not, the message will be closed. So don't erase any subtitle in this template (they start with ###)
and complete all of them -->
### Describe the bug
<!-- A clear and concise description of what the bug is. -->
### To Reproduce
<!-- Steps to reproduce the behavior -->
### Expected behavior
<!-- A clear and concise description of what you expected to happen. -->
### Flight controller configuration
<!-- Create a diff and post it here in a code block. Put (three backticks) at the start and end of the diff block (instructions on how to do a diff: https://oscarliang.com/use-diff-not-dump-betaflight/)
Use resource show all to create a resource allocation list and post it here in a code block. Put (three backticks) at the start and end of the output block. -->
```
PASTE THE OUTPUT OF 'diff' HERE
```
```
PASTE THE OUTPUT OF 'resource show all' HERE
```
### Setup / Versions
<!-- Specify your flight controller model (what type is it, where was it bought from, ...) -->
- Flight controller:
<!-- Specify other components attached to the flight controller (RX, VTX, brand / model for all of them, firmware version where applicable...) -->
- Other components:
<!-- Details about how all is wired -->
- How are the different components wired up:
<!-- Add any other context about the problem that you think might be relevant here. -->

View File

@ -0,0 +1,77 @@
name: Firmware Bug Report
description: Create a report to help us fix bugs in the Betaflight firmware.
labels: [Template: Bug]
body:
- type: markdown
attributes:
value: |
# Please fill all the fields with the required information
- type: textarea
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: To Reproduce
description: Steps to reproduce the behavior.
validations:
required: true
- type: textarea
attributes:
label: Expected behavior
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: textarea
attributes:
label: Flight controller configuration
description: |
Create a `diff` and post it here in a code block. Put (three backticks) at the start and end of the diff block (instructions on how to do a diff: https://oscarliang.com/use-diff-not-dump-betaflight/).
Use `resource show all` to create a resource allocation list and post it here in a code block. Put (three backticks) at the start and end of the output block.
value: |
```
# REPLACE THIS LINE BY THE OUTPUT OF YOUR `diff`
```
```
# REPLACE THIS LINE BY THE OUTPUT OF YOUR `resource show all`
```
validations:
required: true
- type: markdown
attributes:
value: |
# Setup / Versions
- type: input
attributes:
label: Flight controller
description: Specify your flight controller model (what type is it, where was it bought from, ...).
validations:
required: true
- type: textarea
attributes:
label: Other components
description: Specify other components attached to the flight controller (RX, VTX, brand / model for all of them, firmware version where applicable...).
- type: textarea
attributes:
label: How are the different components wired up
description: Details about how all is wired.
- type: markdown
attributes:
value: |
# Other information
- type: textarea
attributes:
label: Add any other context about the problem that you think might be relevant here

View File

@ -1,22 +0,0 @@
name: Issues
on:
issues:
types: [opened, edited]
jobs:
auto_close_issues:
name: Check if issues follow the templates
runs-on: ubuntu-latest
steps:
- name: Checkout templates
uses: actions/checkout@v2.3.4
- name: Automatically close issues that don't follow the templates
uses: ergo720/auto-close-issues@v1.0.4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-close-message: >
@${issue.user.login}: This issue is being automatically closed because it does not follow the template.\n\n
**When you open an issue or feature request you are presented with a template. Follow the guidelines**.\n\n
You can edit your message to fix this and the issue will be automatically reopened.
closed-issues-label: Not following template

View File

@ -101,6 +101,7 @@
#include "pg/vcd.h"
#include "pg/vtx_io.h"
#include "pg/usb.h"
#include "pg/scheduler.h"
#include "pg/sdio.h"
#include "pg/rcdevice.h"
#include "pg/stats.h"
@ -1682,6 +1683,9 @@ const clivalue_t valueTable[] = {
{ "expresslrs_model_id", VAR_UINT8 | MASTER_VALUE, .config.minmaxUnsigned = { 0, UINT8_MAX }, PG_RX_EXPRESSLRS_SPI_CONFIG, offsetof(rxExpressLrsSpiConfig_t, modelId) },
#endif
{ "scheduler_relax_rx", VAR_UINT16 | HARDWARE_VALUE, .config.minmaxUnsigned = { 0, 500 }, PG_SCHEDULER_CONFIG, PG_ARRAY_ELEMENT_OFFSET(schedulerConfig_t, 0, rxRelaxDeterminism) },
{ "scheduler_relax_osd", VAR_UINT16 | HARDWARE_VALUE, .config.minmaxUnsigned = { 0, 500 }, PG_SCHEDULER_CONFIG, PG_ARRAY_ELEMENT_OFFSET(schedulerConfig_t, 0, osdRelaxDeterminism) },
// PG_TIMECONFIG
#ifdef USE_RTC_TIME
{ "timezone_offset_minutes", VAR_INT16 | MASTER_VALUE, .config.minmax = { TIMEZONE_OFFSET_MINUTES_MIN, TIMEZONE_OFFSET_MINUTES_MAX }, PG_TIME_CONFIG, offsetof(timeConfig_t, tz_offsetMinutes) },

View File

@ -95,64 +95,65 @@
// betaflight specific parameter group ids start at 500
#define PG_BETAFLIGHT_START 500
#define PG_BETAFLIGHT_START 500
//#define PG_MODE_ACTIVATION_OPERATOR_CONFIG 500 removed
#define PG_OSD_CONFIG 501
#define PG_BEEPER_CONFIG 502
#define PG_BEEPER_DEV_CONFIG 503
#define PG_PID_CONFIG 504
#define PG_STATUS_LED_CONFIG 505
#define PG_FLASH_CONFIG 506
#define PG_PPM_CONFIG 507
#define PG_PWM_CONFIG 508
#define PG_SERIAL_PIN_CONFIG 509
#define PG_ADC_CONFIG 510
#define PG_SDCARD_CONFIG 511
#define PG_DISPLAY_PORT_MSP_CONFIG 512
#define PG_OSD_CONFIG 501
#define PG_BEEPER_CONFIG 502
#define PG_BEEPER_DEV_CONFIG 503
#define PG_PID_CONFIG 504
#define PG_STATUS_LED_CONFIG 505
#define PG_FLASH_CONFIG 506
#define PG_PPM_CONFIG 507
#define PG_PWM_CONFIG 508
#define PG_SERIAL_PIN_CONFIG 509
#define PG_ADC_CONFIG 510
#define PG_SDCARD_CONFIG 511
#define PG_DISPLAY_PORT_MSP_CONFIG 512
#define PG_DISPLAY_PORT_MAX7456_CONFIG 513
#define PG_VCD_CONFIG 514
#define PG_VTX_CONFIG 515
#define PG_SONAR_CONFIG 516
#define PG_ESC_SENSOR_CONFIG 517
#define PG_I2C_CONFIG 518
#define PG_DASHBOARD_CONFIG 519
#define PG_SPI_PIN_CONFIG 520
#define PG_ESCSERIAL_CONFIG 521
#define PG_CAMERA_CONTROL_CONFIG 522
#define PG_RX_CC2500_SPI_CONFIG 523
#define PG_MAX7456_CONFIG 524
#define PG_FLYSKY_CONFIG 525
#define PG_TIME_CONFIG 526
#define PG_RANGEFINDER_CONFIG 527 // iNav
#define PG_TRICOPTER_CONFIG 528
#define PG_PINIO_CONFIG 529
#define PG_PINIOBOX_CONFIG 530
#define PG_USB_CONFIG 531
#define PG_SDIO_CONFIG 532
#define PG_VCD_CONFIG 514
#define PG_VTX_CONFIG 515
#define PG_SONAR_CONFIG 516
#define PG_ESC_SENSOR_CONFIG 517
#define PG_I2C_CONFIG 518
#define PG_DASHBOARD_CONFIG 519
#define PG_SPI_PIN_CONFIG 520
#define PG_ESCSERIAL_CONFIG 521
#define PG_CAMERA_CONTROL_CONFIG 522
#define PG_RX_CC2500_SPI_CONFIG 523
#define PG_MAX7456_CONFIG 524
#define PG_FLYSKY_CONFIG 525
#define PG_TIME_CONFIG 526
#define PG_RANGEFINDER_CONFIG 527 // iNav
#define PG_TRICOPTER_CONFIG 528
#define PG_PINIO_CONFIG 529
#define PG_PINIOBOX_CONFIG 530
#define PG_USB_CONFIG 531
#define PG_SDIO_CONFIG 532
#define PG_DISPLAY_PORT_CRSF_CONFIG 533 // no longer required -- never released
#define PG_TIMER_IO_CONFIG 534 // used to store the index for timer use in timerHardware array in target.c
#define PG_SPI_PREINIT_IPU_CONFIG 535
#define PG_SPI_PREINIT_OPU_CONFIG 536
#define PG_RX_SPI_CONFIG 537
#define PG_BOARD_CONFIG 538
#define PG_RCDEVICE_CONFIG 539
#define PG_GYRO_DEVICE_CONFIG 540
#define PG_MCO_CONFIG 541
#define PG_RX_SPEKTRUM_SPI_CONFIG 542
#define PG_SERIAL_UART_CONFIG 543
#define PG_RPM_FILTER_CONFIG 544
#define PG_TIMER_IO_CONFIG 534 // used to store the index for timer use in timerHardware array in target.c
#define PG_SPI_PREINIT_IPU_CONFIG 535
#define PG_SPI_PREINIT_OPU_CONFIG 536
#define PG_RX_SPI_CONFIG 537
#define PG_BOARD_CONFIG 538
#define PG_RCDEVICE_CONFIG 539
#define PG_GYRO_DEVICE_CONFIG 540
#define PG_MCO_CONFIG 541
#define PG_RX_SPEKTRUM_SPI_CONFIG 542
#define PG_SERIAL_UART_CONFIG 543
#define PG_RPM_FILTER_CONFIG 544
#define PG_LED_STRIP_STATUS_MODE_CONFIG 545 // Used to hold the configuration for the LED_STRIP status mode (not built on targets with limited flash)
#define PG_VTX_TABLE_CONFIG 546
#define PG_STATS_CONFIG 547
#define PG_QUADSPI_CONFIG 548
#define PG_TIMER_UP_CONFIG 549 // used to store dmaopt for TIMx_UP channel
#define PG_SDIO_PIN_CONFIG 550
#define PG_PULLUP_CONFIG 551
#define PG_PULLDOWN_CONFIG 552
#define PG_MODE_ACTIVATION_CONFIG 553
#define PG_DYN_NOTCH_CONFIG 554
#define PG_VTX_TABLE_CONFIG 546
#define PG_STATS_CONFIG 547
#define PG_QUADSPI_CONFIG 548
#define PG_TIMER_UP_CONFIG 549 // used to store dmaopt for TIMx_UP channel
#define PG_SDIO_PIN_CONFIG 550
#define PG_PULLUP_CONFIG 551
#define PG_PULLDOWN_CONFIG 552
#define PG_MODE_ACTIVATION_CONFIG 553
#define PG_DYN_NOTCH_CONFIG 554
#define PG_RX_EXPRESSLRS_SPI_CONFIG 555
#define PG_BETAFLIGHT_END 555
#define PG_SCHEDULER_CONFIG 556
#define PG_BETAFLIGHT_END 556
// OSD configuration (subject to change)

31
src/main/pg/scheduler.c Normal file
View File

@ -0,0 +1,31 @@
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "platform.h"
#include "pg/pg_ids.h"
#include "pg/scheduler.h"
PG_REGISTER_WITH_RESET_TEMPLATE(schedulerConfig_t, schedulerConfig, PG_SCHEDULER_CONFIG, 0);
PG_RESET_TEMPLATE(schedulerConfig_t, schedulerConfig,
.rxRelaxDeterminism = SCHEDULER_RELAX_RX,
.osdRelaxDeterminism = SCHEDULER_RELAX_OSD,
);

40
src/main/pg/scheduler.h Normal file
View File

@ -0,0 +1,40 @@
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "pg/pg.h"
#ifdef STM32F411xE
// Allow RX and OSD tasks to be scheduled at the second attempt on F411 processors
#define SCHEDULER_RELAX_RX 1
#define SCHEDULER_RELAX_OSD 1
#else
#define SCHEDULER_RELAX_RX 25
#define SCHEDULER_RELAX_OSD 25
#endif
typedef struct schedulerConfig_s {
uint16_t rxRelaxDeterminism;
uint16_t osdRelaxDeterminism;
} schedulerConfig_t;
PG_DECLARE(schedulerConfig_t, schedulerConfig);

View File

@ -659,9 +659,9 @@ FAST_CODE void scheduler(void)
#endif // USE_LATE_TASK_STATISTICS
} else if ((selectedTask->taskAgePeriods > TASK_AGE_EXPEDITE_COUNT) ||
#ifdef USE_OSD
(((selectedTask - tasks) == TASK_OSD) && (++skippedOSDAttempts > TASK_AGE_EXPEDITE_OSD)) ||
(((selectedTask - tasks) == TASK_OSD) && (TASK_AGE_EXPEDITE_OSD != 0) && (++skippedOSDAttempts > TASK_AGE_EXPEDITE_OSD)) ||
#endif
(((selectedTask - tasks) == TASK_RX) && (++skippedRxAttempts > TASK_AGE_EXPEDITE_RX))) {
(((selectedTask - tasks) == TASK_RX) && (TASK_AGE_EXPEDITE_RX != 0) && (++skippedRxAttempts > TASK_AGE_EXPEDITE_RX))) {
// If a task has been unable to run, then reduce it's recorded estimated run time to ensure
// it's ultimate scheduling
selectedTask->anticipatedExecutionTime *= TASK_AGE_EXPEDITE_SCALE;

View File

@ -22,6 +22,7 @@
#include "common/time.h"
#include "config/config.h"
#include "pg/scheduler.h"
#define TASK_PERIOD_HZ(hz) (1000000 / (hz))
#define TASK_PERIOD_MS(ms) ((ms) * 1000)
@ -47,8 +48,8 @@
// Decay the estimated max task duration by 1/(1 << TASK_EXEC_TIME_SHIFT) on every invocation
#define TASK_EXEC_TIME_SHIFT 7
#define TASK_AGE_EXPEDITE_RX 25 // Make RX tasks more schedulable if it's failed to be scheduled this many times
#define TASK_AGE_EXPEDITE_OSD 25 // Make OSD tasks more schedulable if it's failed to be scheduled this many times
#define TASK_AGE_EXPEDITE_RX schedulerConfig()->rxRelaxDeterminism // Make RX tasks more schedulable if it's failed to be scheduled this many times
#define TASK_AGE_EXPEDITE_OSD schedulerConfig()->osdRelaxDeterminism // Make OSD tasks more schedulable if it's failed to be scheduled this many times
#define TASK_AGE_EXPEDITE_COUNT 1 // Make aged tasks more schedulable
#define TASK_AGE_EXPEDITE_SCALE 0.9 // By scaling their expected execution time

View File

@ -19,7 +19,17 @@
extern "C" {
#include "platform.h"
#include "pg/pg.h"
#include "pg/pg_ids.h"
#include "pg/scheduler.h"
#include "scheduler/scheduler.h"
PG_REGISTER_WITH_RESET_TEMPLATE(schedulerConfig_t, schedulerConfig, PG_SCHEDULER_CONFIG, 0);
PG_RESET_TEMPLATE(schedulerConfig_t, schedulerConfig,
.rxRelaxDeterminism = 25,
.osdRelaxDeterminism = 25,
);
}
#include "unittest_macros.h"