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

@ -152,7 +152,8 @@
#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"