mirror of
https://github.com/iNavFlight/inav.git
synced 2025-07-24 16:55:29 +03:00
Merge branch 'development' into jh_gcc_8_dev
This commit is contained in:
commit
a0a025ba2c
9 changed files with 123 additions and 18 deletions
11
Vagrantfile
vendored
11
Vagrantfile
vendored
|
@ -14,14 +14,19 @@ Vagrant.configure(2) do |config|
|
|||
# boxes at https://atlas.hashicorp.com/search.
|
||||
config.vm.box = "ubuntu/trusty64"
|
||||
config.vm.synced_folder ".", "/home/vagrant/inav"
|
||||
|
||||
config.vm.hostname = "iNavDev"
|
||||
config.vm.define "iNavDev"
|
||||
config.vm.provider :virtualbox do |vb|
|
||||
vb.name = "iNavDev"
|
||||
end
|
||||
# Enable provisioning with a shell script. Additional provisioners such as
|
||||
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
|
||||
# documentation for more information about their specific syntax and use.
|
||||
config.vm.provision "shell", inline: <<-SHELL
|
||||
sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
|
||||
sudo apt-get remove -y --force-yes gcc-arm-none-eabi ruby
|
||||
sudo apt-add-repository ppa:brightbox/ruby-ng
|
||||
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y --force-yes git gcc-arm-none-eabi=4.9.3.2015q3-1trusty1 libnewlib-arm-none-eabi ruby2.4 ruby2.4-dev
|
||||
sudo apt-get install -y --force-yes git gcc-arm-embedded ruby2.4 ruby2.4-dev
|
||||
SHELL
|
||||
end
|
||||
|
|
|
@ -227,9 +227,9 @@ Re-apply any new defaults as desired.
|
|||
| align_gyro | DEFAULT | When running on non-default hardware or adding support for new sensors/sensor boards, these values are used for sensor orientation. When carefully understood, these values can also be used to rotate (in 90deg steps) or flip the board. Possible values are: DEFAULT, CW0_DEG, CW90_DEG, CW180_DEG, CW270_DEG, CW0_DEG_FLIP, CW90_DEG_FLIP, CW180_DEG_FLIP, CW270_DEG_FLIP. |
|
||||
| align_acc | DEFAULT | When running on non-default hardware or adding support for new sensors/sensor boards, these values are used for sensor orientation. When carefully understood, these values can also be used to rotate (in 90deg steps) or flip the board. Possible values are: DEFAULT, CW0_DEG, CW90_DEG, CW180_DEG, CW270_DEG, CW0_DEG_FLIP, CW90_DEG_FLIP, CW180_DEG_FLIP, CW270_DEG_FLIP. |
|
||||
| align_mag | DEFAULT | When running on non-default hardware or adding support for new sensors/sensor boards, these values are used for sensor orientation. When carefully understood, these values can also be used to rotate (in 90deg steps) or flip the board. Possible values are: DEFAULT, CW0_DEG, CW90_DEG, CW180_DEG, CW270_DEG, CW0_DEG_FLIP, CW90_DEG_FLIP, CW180_DEG_FLIP, CW270_DEG_FLIP. |
|
||||
| align_board_roll | 0 | Arbitrary board rotation in degrees, to allow mounting it sideways / upside down / rotated etc |
|
||||
| align_board_pitch | 0 | Arbitrary board rotation in degrees, to allow mounting it sideways / upside down / rotated etc |
|
||||
| align_board_yaw | 0 | Arbitrary board rotation in degrees, to allow mounting it sideways / upside down / rotated etc |
|
||||
| align_board_roll | 0 | Arbitrary board rotation in deci-degrees (0.1 degree), to allow mounting it sideways / upside down / rotated etc |
|
||||
| align_board_pitch | 0 | Arbitrary board rotation in deci-degrees (0.1 degree), to allow mounting it sideways / upside down / rotated etc |
|
||||
| align_board_yaw | 0 | Arbitrary board rotation in deci-degrees (0.1 degree), to allow mounting it sideways / upside down / rotated etc |
|
||||
| align_mag_roll | 0 | Set the external mag alignment on the roll axis (in 0.1 degree steps). If this value is non-zero, the compass is assumed to be externally mounted and both the board and on-board compass alignent (align_mag) are ignored. See also align_mag_pitch and align_mag_yaw. |
|
||||
| align_mag_pitch | 0 | Same as align_mag_roll, but for the pitch axis. |
|
||||
| align_mag_yaw | 0 | Same as align_mag_roll, but for the yaw axis. |
|
||||
|
|
89
docs/development/Building in Vagrant.md
Normal file
89
docs/development/Building in Vagrant.md
Normal file
|
@ -0,0 +1,89 @@
|
|||
# Building with Vagrant
|
||||
|
||||
Setting up build environment with Vagrant is remarkably simple, but you still need to have some basic knowlage of your OS.
|
||||
|
||||
## Installing Vagrant
|
||||
Vagrant needs some kind of virtualization software to run, i.e. VirtualBox.
|
||||
You can get VirtualBox from here:
|
||||
```
|
||||
https://www.virtualbox.org/wiki/Downloads
|
||||
```
|
||||
|
||||
Download and install Vagrant for you OS from here:
|
||||
```
|
||||
https://www.vagrantup.com/downloads.html
|
||||
```
|
||||
|
||||
## Cloning iNav repository
|
||||
Using git (The preferred way!)
|
||||
```
|
||||
git clone https://github.com/iNavFlight/inav.git
|
||||
```
|
||||
|
||||
Or download the .zip file from
|
||||
```
|
||||
https://github.com/iNavFlight/inav
|
||||
```
|
||||
and extract it to folder of your choosing.
|
||||
|
||||
## Running the virtual machine
|
||||
Open up a terminal or command line interface (In windows search for CMD.exe and run it as administrator!)
|
||||
Navigate in to the directory of your cloned/unzipped iNav repository. (Where the "Vagrantfile" is located.) and start the virtual machine.
|
||||
```
|
||||
vagrant up
|
||||
```
|
||||
|
||||
Starting the virtual machine might take some time depending on your computer speed.
|
||||
When you start the virtual machine for the first time, it has to download the base virtual machine files and do some installation steps,
|
||||
so it takes longer than the following times you start it.
|
||||
|
||||
|
||||
When the start up has finished succesfully and you are back to your command prompt. Login in to the virtual machine.
|
||||
```
|
||||
vagrant ssh
|
||||
```
|
||||
|
||||
## Building firmware
|
||||
In the virtual machine, go to the inav directory
|
||||
```
|
||||
cd inav
|
||||
```
|
||||
|
||||
If you downloadet the repository as a zip file, you may have to type:
|
||||
```
|
||||
git init
|
||||
```
|
||||
|
||||
To stop the file system boundary warnings.
|
||||
|
||||
Build your desired target
|
||||
i.e.
|
||||
```
|
||||
make TARGET=AIRBOTF4
|
||||
```
|
||||
|
||||
## Updating and rebuilding the firmware
|
||||
|
||||
```
|
||||
git reset --hard
|
||||
git pull
|
||||
make clean TARGET=AIRBOTF4
|
||||
make TARGET=AIRBOTF4
|
||||
```
|
||||
|
||||
## Additional virtual machine commands
|
||||
|
||||
Exit from the virtual machine interface with:
|
||||
```
|
||||
exit
|
||||
```
|
||||
|
||||
Shutdown the virtual machine with:
|
||||
```
|
||||
vagrant halt
|
||||
```
|
||||
|
||||
Remove the virtual machine files from your computer with:
|
||||
```
|
||||
vagrant destroy
|
||||
```
|
|
@ -83,7 +83,7 @@
|
|||
#define SYM_CELLF 0xC3
|
||||
|
||||
// Map mode
|
||||
#define SYM_HOME 0x04
|
||||
#define SYM_HOME 191
|
||||
#define SYM_AIRCRAFT 0x05
|
||||
#define SYM_RANGE_100 0x21
|
||||
#define SYM_RANGE_500 0x22
|
||||
|
|
|
@ -700,6 +700,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
sbufWriteU16(dst, compassConfig()->mag_declination / 10);
|
||||
|
||||
sbufWriteU16(dst, batteryConfig()->voltage.scale);
|
||||
sbufWriteU16(dst, batteryConfig()->voltage.cellDetect);
|
||||
sbufWriteU16(dst, batteryConfig()->voltage.cellMin);
|
||||
sbufWriteU16(dst, batteryConfig()->voltage.cellMax);
|
||||
sbufWriteU16(dst, batteryConfig()->voltage.cellWarning);
|
||||
|
@ -712,6 +713,7 @@ static bool mspFcProcessOutCommand(uint16_t cmdMSP, sbuf_t *dst, mspPostProcessF
|
|||
|
||||
case MSP2_INAV_BATTERY_CONFIG:
|
||||
sbufWriteU16(dst, batteryConfig()->voltage.scale);
|
||||
sbufWriteU16(dst, batteryConfig()->voltage.cellDetect);
|
||||
sbufWriteU16(dst, batteryConfig()->voltage.cellMin);
|
||||
sbufWriteU16(dst, batteryConfig()->voltage.cellMax);
|
||||
sbufWriteU16(dst, batteryConfig()->voltage.cellWarning);
|
||||
|
@ -1613,7 +1615,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
break;
|
||||
|
||||
case MSP2_INAV_SET_MISC:
|
||||
if (dataSize == 37) {
|
||||
if (dataSize == 39) {
|
||||
rxConfigMutable()->midrc = constrain(sbufReadU16(src), MIDRC_MIN, MIDRC_MAX);
|
||||
|
||||
motorConfigMutable()->minthrottle = constrain(sbufReadU16(src), PWM_RANGE_MIN, PWM_RANGE_MAX);
|
||||
|
@ -1643,6 +1645,7 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
#endif
|
||||
|
||||
batteryConfigMutable()->voltage.scale = sbufReadU16(src);
|
||||
batteryConfigMutable()->voltage.cellDetect = sbufReadU16(src);
|
||||
batteryConfigMutable()->voltage.cellMin = sbufReadU16(src);
|
||||
batteryConfigMutable()->voltage.cellMax = sbufReadU16(src);
|
||||
batteryConfigMutable()->voltage.cellWarning = sbufReadU16(src);
|
||||
|
@ -1660,8 +1663,9 @@ static mspResult_e mspFcProcessInCommand(uint16_t cmdMSP, sbuf_t *src)
|
|||
break;
|
||||
|
||||
case MSP2_INAV_SET_BATTERY_CONFIG:
|
||||
if (dataSize == 25) {
|
||||
if (dataSize == 27) {
|
||||
batteryConfigMutable()->voltage.scale = sbufReadU16(src);
|
||||
batteryConfigMutable()->voltage.cellDetect = sbufReadU16(src);
|
||||
batteryConfigMutable()->voltage.cellMin = sbufReadU16(src);
|
||||
batteryConfigMutable()->voltage.cellMax = sbufReadU16(src);
|
||||
batteryConfigMutable()->voltage.cellWarning = sbufReadU16(src);
|
||||
|
|
|
@ -501,6 +501,11 @@ groups:
|
|||
condition: USE_ADC
|
||||
min: VBAT_SCALE_MIN
|
||||
max: VBAT_SCALE_MAX
|
||||
- name: vbat_cell_detect_voltage
|
||||
field: voltage.cellDetect
|
||||
condition: USE_ADC
|
||||
min: 100
|
||||
max: 500
|
||||
- name: vbat_max_cell_voltage
|
||||
field: voltage.cellMax
|
||||
condition: USE_ADC
|
||||
|
|
|
@ -931,7 +931,8 @@ static bool osdDrawSingleElement(uint8_t item)
|
|||
|
||||
case OSD_HOME_DIST:
|
||||
{
|
||||
osdFormatDistanceSymbol(buff, GPS_distanceToHome * 100);
|
||||
buff[0] = SYM_HOME;
|
||||
osdFormatDistanceSymbol(&buff[1], GPS_distanceToHome * 100);
|
||||
uint16_t dist_alarm = osdConfig()->dist_alarm;
|
||||
if (dist_alarm > 0 && GPS_distanceToHome > dist_alarm) {
|
||||
TEXT_ATTRIBUTES_ADD_BLINK(elemAttr);
|
||||
|
@ -1570,9 +1571,8 @@ static uint8_t osdIncElementIndex(uint8_t elementIndex)
|
|||
if (elementIndex == OSD_CURRENT_DRAW) {
|
||||
elementIndex = OSD_GPS_SPEED;
|
||||
}
|
||||
if (elementIndex == OSD_TRIP_DIST) {
|
||||
STATIC_ASSERT(OSD_TRIP_DIST == OSD_ITEM_COUNT - 1, OSD_TRIP_DIST_not_last_element);
|
||||
elementIndex = OSD_ITEM_COUNT;
|
||||
if (elementIndex == OSD_EFFICIENCY_MAH_PER_KM) {
|
||||
elementIndex = OSD_TRIP_DIST;
|
||||
}
|
||||
}
|
||||
if (!feature(FEATURE_GPS)) {
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
#define ADCVREF 3300 // in mV (3300 = 3.3V)
|
||||
|
||||
#define VBATT_CELL_FULL_MAX_DIFF 14 // Max difference with cell max voltage for the battery to be considered full (10mV steps)
|
||||
#define VBATT_CELL_FULL_MAX_DIFF 10 // Max difference with cell max voltage for the battery to be considered full (10mV steps)
|
||||
#define VBATT_PRESENT_THRESHOLD 100 // Minimum voltage to consider battery present
|
||||
#define VBATT_STABLE_DELAY 40 // Delay after connecting battery to begin monitoring
|
||||
#define VBATT_HYSTERESIS 10 // Batt Hysteresis of +/-100mV for changing battery state
|
||||
|
@ -73,13 +73,14 @@ static int32_t mWhDrawn = 0; // energy (milliWatt hours) drawn fro
|
|||
|
||||
batteryState_e batteryState;
|
||||
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(batteryConfig_t, batteryConfig, PG_BATTERY_CONFIG, 1);
|
||||
PG_REGISTER_WITH_RESET_TEMPLATE(batteryConfig_t, batteryConfig, PG_BATTERY_CONFIG, 2);
|
||||
|
||||
PG_RESET_TEMPLATE(batteryConfig_t, batteryConfig,
|
||||
|
||||
.voltage = {
|
||||
.scale = VBAT_SCALE_DEFAULT,
|
||||
.cellMax = 424,
|
||||
.cellDetect = 430,
|
||||
.cellMax = 420,
|
||||
.cellMin = 330,
|
||||
.cellWarning = 350
|
||||
},
|
||||
|
@ -148,7 +149,7 @@ void batteryUpdate(uint32_t vbatTimeDelta)
|
|||
delay(VBATT_STABLE_DELAY);
|
||||
updateBatteryVoltage(vbatTimeDelta);
|
||||
|
||||
unsigned cells = (batteryAdcToVoltage(vbatLatestADC) / batteryConfig()->voltage.cellMax) + 1;
|
||||
unsigned cells = (batteryAdcToVoltage(vbatLatestADC) / batteryConfig()->voltage.cellDetect) + 1;
|
||||
if (cells > 8) cells = 8; // something is wrong, we expect 8 cells maximum (and autodetection will be problematic at 6+ cells)
|
||||
|
||||
batteryCellCount = cells;
|
||||
|
|
|
@ -49,7 +49,8 @@ typedef struct batteryConfig_s {
|
|||
|
||||
struct {
|
||||
uint16_t scale; // adjust this to match battery voltage to reported value
|
||||
uint16_t cellMax; // maximum voltage per cell, used for auto-detecting battery voltage in 0.01V units, default is 421 (4.21V)
|
||||
uint16_t cellDetect; // maximum voltage per cell, used for auto-detecting battery cell count in 0.01V units, default is 430 (4.3V)
|
||||
uint16_t cellMax; // maximum voltage per cell, used for full battery detection and battery gauge voltage in 0.01V units, default is 424 (4.24V)
|
||||
uint16_t cellMin; // minimum voltage per cell, this triggers battery critical alarm, in 0.01V units, default is 330 (3.3V)
|
||||
uint16_t cellWarning; // warning voltage per cell, this triggers battery warning alarm, in 0.01V units, default is 350 (3.5V)
|
||||
} voltage;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue