Skip to content

Commit

Permalink
Merge branch 'master' into haslinghuis-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
haslinghuis authored Dec 11, 2023
2 parents 48c03b5 + 55b4708 commit 0faf1a6
Show file tree
Hide file tree
Showing 54 changed files with 11,591 additions and 20,312 deletions.
223 changes: 112 additions & 111 deletions docs/development/Betaflight-Contribution.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ This document gives some instructions how to handle Git. First make a fork of th
Please contribute to this article to help others make git easier to use.

## Clone your fork to your development machine.

git clone https://github.com/yourname/betaflight.git

```
git clone https://github.com/yourname/betaflight.git
```
## Global configuration

Please configure this to have the correct author in your commits

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

```
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
```
If you omit to configure this you get a warning and have to use the following commands to rectify:

git config --global --edit
git commit --amend --reset-author

```
git config --global --edit
git commit --amend --reset-author
```
## Recommended git global environment:

# Windows:
Expand All @@ -39,111 +39,112 @@ If you omit to configure this you get a warning and have to use the following co
git config --global help.autocorrect true

## Setup remotes

git remote add upstream https://github.com/betaflight/betaflight.git
git remote -v

```
git remote add upstream https://github.com/betaflight/betaflight.git
git remote -v
```
## Create a branch and start making changes

git checkout -b branch

```
git checkout -b branch
```
## Stage files for commit

Commit your changes after making initial changes:

git add .
git commit -m "message"
git push origin branch

```
git add .
git commit -m "message"
git push origin branch
```
Note: `git commit -am` or specify the files.

## Make more changes and commit on top of last commit

git commit --amend
git push origin +branch

```
git commit --amend
git push origin +branch
```
## Update master branch with upstream updates and update your fork

git checkout master
git pull --rebase upstream master
git push origin +master

```
git checkout master
git pull --rebase upstream master
git push origin +master
```
## Update your local branch with upstream changes

git checkout branch
git branch --set-upstream-to=upstream/master branch
git pull --rebase

```
git checkout branch
git branch --set-upstream-to=upstream/master branch
git pull --rebase
```
or

git pull upstream master
git rebase -i master

```
git pull upstream master
git rebase -i master
```
If you look at `git reflog --oneline` you will see these lines:

shacode HEAD@{0}: rebase (finish): returning to refs/head/branch
shacode HEAD@{1}: rebase (pick): your branch commit description
shacode (upstream/master, origin/master, origin/HEAD, master) HEAD@{2}: rebase (start): checkout longsha

```
shacode HEAD@{0}: rebase (finish): returning to refs/head/branch
shacode HEAD@{1}: rebase (pick): your branch commit description
shacode (upstream/master, origin/master, origin/HEAD, master) HEAD@{2}: rebase (start): checkout longsha
```
## Unstage file from working area

git restore --staged <file> to unstage a file from working area.
```
git restore --staged \<file> to unstage a file from working area.
```

or

git checkout --<filename>

```
git checkout --\<filename>
```
## Recover from unwanted commit without push

git reset HEAD^

```
git reset HEAD^
```
## If you want to completely remove the unstaged changes run

git reset --hard HEAD

```
git reset --hard HEAD
```
## Unwanted commits in your latest push.

First try:

git rebase -i origin/branch~2 branch
git push origin +branch

```
git rebase -i origin/branch~2 branch
git push origin +branch
```
If this fails, backup your changed files (maybe also could use git stash)

git reset HEAD~ --hard
git checkout branch

```
git reset HEAD~ --hard
git checkout branch
```
And restore your saved files (or use git stash pop)

git add .
git commit -m "Make new commit"
git push origin +branch

```
git add .
git commit -m "Make new commit"
git push origin +branch
```
## See general changes

git diff

```
git diff
```
## See changes in particular file

git log -- src/main/cms/cms` .c

```
git log -- src/main/cms/cms` .c
```
## Checkout work on another machine

git checkout origin/branch
git switch -c branch

```
git checkout origin/branch
git switch -c branch
```
## Quickly testing a PR

git fetch upstream pull/2500/head:2500
git checkout 2500

```
git fetch upstream pull/2500/head:2500
git checkout 2500
```
## Squash your commits

From the project folder you can use somethink like: https://www.scraggo.com/how-to-squash-commits.
Note the number of commits in your PR.

git rebase -i HEAD~17

```
git rebase -i HEAD~17
```
- You should see a list of commits, each commit starting with the word “pick”.
- Make sure the topmost, first commit says “pick” and change the rest below from “pick” to “squash”. This will squash each commit into the previous commit, which will continue until every commit is squashed into the first commit.
- Save and close the editor.
Expand All @@ -152,24 +153,24 @@ Note the number of commits in your PR.
- Important: If you’ve already pushed commits to origin, and then squash them locally, you will have to force the push to your branch.

Finally update with:

git push origin +branch

```
git push origin +branch
```
## Commit to a PR from another contributor

Sometimes you want to make changes to an existing PR.
Before doing so please ask permission from the contributor.
In the example please substitute the contributor, betaflight_project and branch:

git remote add contributor https://github.com/contributor/betaflight_project.git
git remote -v
git fetch contributor
git switch branch

```
git remote add contributor https://github.com/contributor/betaflight_project.git
git remote -v
git fetch contributor
git switch branch
```
The original author now can pull the changes to the local branch with:

git fetch origin branch:branch --update-head-ok

```
git fetch origin branch:branch --update-head-ok
```
Now you can make more changes and commit again. (This should just work with git pull - have to check this)

# Advanced
Expand All @@ -183,20 +184,20 @@ When using commit just add the -S flag to verify the commit and enter the passph
## Bisection

Do bisection:

git bisect reset
git bisect start
git checkout 4.1.1

```
git bisect reset
git bisect start
git checkout 4.1.1
```
Build and make sure it works

git bisect good
git checkout 4.1.2

```
git bisect good
git checkout 4.1.2
```
Build and make sure it fails

git bisect bad

```
git bisect bad
```
Then git will automatically bisects commits between the two versions, checks out a new bisecting commit.
You will build and test it, and tell git if the commit was good or bad.

Expand Down
2 changes: 1 addition & 1 deletion docs/development/Blackbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ board). SoftSerial ports can be used for the Blackbox. However, because they are
rate will need to be severely reduced to compensate. Therefore the use of SoftSerial is not recommended.

When using a hardware serial port, Blackbox should be set to at least 115200 baud on that port. When using fast
looptimes (<2500), a baud rate of 250000 should be used instead in order to reduce dropped frames.
looptimes (\<2500), a baud rate of 250000 should be used instead in order to reduce dropped frames.

The serial port used for Blackbox cannot be shared with any other function (e.g. GPS, telemetry) except the MSP
protocol. If MSP is used on the same port as Blackbox, then MSP will be active when the board is disarmed, and Blackbox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Then do the following in the Linux subsystem:
The root file system for the Linux Subsystem is available from Windows here:
`C:\Users\\<username\>\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs`

In earlier iterations of Windows Subsystem for Linux, the Ubuntu file system was at %localappdata%\Lxss (e.g., C:\Users\\<username\>\AppData\Local\Lxss But it has now moved to the location mentioned above. Beware there are still a lot of incorrect information about this floating around. Even on MS own site.
In earlier iterations of Windows Subsystem for Linux, the Ubuntu file system was at %localappdata%\Lxss (e.g., `C:\Users\\<username>\AppData\Local\Lxss` But it has now moved to the location mentioned above. Beware there are still a lot of incorrect information about this floating around. Even on MS own site.

Under normal circumstances, avoid doing anything in these folder as much as possible, it might mess up the Linux subsystem.

Expand Down
71 changes: 37 additions & 34 deletions docs/development/Building-in-Fedora.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,52 @@
# Building in Fedora 35

$ sudo dnf check-update
$ sudo dnf install git clang libblocksruntime-devel
$ sudo dnf group install "C Development Tools and Libraries"
$ git clone https://github.com/betaflight/betaflight.git
$ cd betaflight
$ make arm_sdk_install
$ make configs
$ make TARGET=MATEKF411

```
$ sudo dnf check-update
$ sudo dnf install git clang libblocksruntime-devel
$ sudo dnf group install "C Development Tools and Libraries"
$ git clone https://github.com/betaflight/betaflight.git
$ cd betaflight
$ make arm_sdk_install
$ make configs
$ make TARGET=MATEKF411
```
### Building Configurator in Fedora 35

$ sudo dnf check-update
$ sudo dnf install libatomic rpm-build dpkg
$ sudo dnf module list nodejs
$ sudo dnf module install nodejs:14/default
$ sudo npm install -g gulp-cli yarn
$ yarn install
$ yarn gulp debug

```
$ sudo dnf check-update
$ sudo dnf install libatomic rpm-build dpkg
$ sudo dnf module list nodejs
$ sudo dnf module install nodejs:14/default
$ sudo npm install -g gulp-cli yarn
$ yarn install
$ yarn gulp debug
```
Note: Please check this link for the required Node version: https://github.com/betaflight/betaflight-configurator#development

### Serial permissions

Remove ModemManager.
Add yourself to the dialout group:

$ sudo dnf remove ModemManager
$ sudo usermod -aG dialout $(whoami)
```
$ sudo dnf remove ModemManager
$ sudo usermod -aG dialout $(whoami)
``````
Save and reboot after adding the following contents:
```
$ sudo nano /etc/udev/rules.d/45-stdfu-permissions.rules

$ sudo nano /etc/udev/rules.d/45-stdfu-permissions.rules

# Notify ModemManager this device should be ignored
ACTION!="add|change|move", GOTO="mm_usb_device_blacklist_end"
SUBSYSTEM!="usb", GOTO="mm_usb_device_blacklist_end"
ENV{DEVTYPE}!="usb_device", GOTO="mm_usb_device_blacklist_end"
# Notify ModemManager this device should be ignored
ACTION!="add|change|move", GOTO="mm_usb_device_blacklist_end"
SUBSYSTEM!="usb", GOTO="mm_usb_device_blacklist_end"
ENV{DEVTYPE}!="usb_device", GOTO="mm_usb_device_blacklist_end"

ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", ENV{ID_MM_DEVICE_IGNORE}="1"

LABEL="mm_usb_device_blacklist_end"
LABEL="mm_usb_device_blacklist_end"

#STM32 DFU Access
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", TAG+="uaccess"
#AT32 DFU Access
SUBSYSTEM=="usb", ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", TAG+="uaccess"
#STM32 DFU Access
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", TAG+="uaccess"
#AT32 DFU Access
SUBSYSTEM=="usb", ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", TAG+="uaccess"
```
Loading

0 comments on commit 0faf1a6

Please sign in to comment.