Skip to content

Commit

Permalink
FW 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
vedderb committed Nov 4, 2016
1 parent e027ad4 commit 5dbc94c
Show file tree
Hide file tree
Showing 827 changed files with 3,769 additions and 104,649 deletions.
50 changes: 50 additions & 0 deletions CHANGELOG
@@ -0,0 +1,50 @@
=== FW 3.7 ===
* Delay after app and motor conf write.
- Fixes NRF bug.
- Fixes glitches if throttle is given while updating the configurations.
* Lock mc_interface while storing configuration.
* Nunchuk app local timeout.
- Prevents the output thread from blocking other outputs after being used before.
* Lock MC interface while storing configurations to flash.

=== FW 3.6 ===
* spi_sw for NRF stop bug fix.

=== FW 3.5 ===
* App NRF pairing.
* App nunchuk chuk error restore bug fix.

=== FW 3.4 ===
* HW version built into firmware.
- Allows VESC Tool to only list firmwares compatible with the hardware.

=== FW 3.2 ===
* hw_60 support.
* hw_das support.
* DRV8301 support.
- SPI implementation.
- Some terminal commands.
* DRV8313 support.
* 3 shunt support.
* Phase shunt support.
* Global RPM limit for both BLDC and FOC.
* Hall sensor software filtering.
* SPI software filtering.
* The software filters remove the need for hardware filtering on the sensor port, making it work for all different sensors without modification.
* Handbrake function for FOC (open loop braking).
* FOC updates and fixes.
- Current control signs.
- Control loop integrator fixes.
- Phase delay compensation and minimization.
- More consistent flux linkage detection.
- Resistance and inductance measurement bug fix that could cause a reboot.
- Timer sampling improvement and cleanup.
- Support for sampling in V0 and V7 when using phase shunts.
* Fix reboot on over temperature fault code.
* Motor temperature measurement and soft backoff.
* Terminal command for rotating magnet field generation (ACIM experimentation).
* Prevent motor start command during initialization.
* Hardware specific default configuration support.
* Stop functionality for apps so that reboots are not required anymore when changing app.
* EEPROM emulation bug fix: https://github.com/vedderb/bldc/issues/27

88 changes: 88 additions & 0 deletions CONTRIBUTING
@@ -0,0 +1,88 @@
So you want to contribute to the VESC firmware? That's great! Benjamin (the creator of the VESC) welcomes more people to join the development.

But Benjamin is a busy man, and to reduce the workload of reviewing patches, it's important that your code follows the guidelines below. These are meant to make _you_ work a bit harder, so that Benjamin can work a bit less (and use his time to develop the VESC instead of trying to fix your patches :).


=== Process ===

Please discuss your ideas in the forum (http://vedder.se/forums/index.php) so that you don't just dump a large amount of code on Benjamin out of nowhere. Try to reach some kind of consensus with others on the forum about scope and functionality of your contribution.

When Benjamin is prepared for your patch, and you have checked that it follows these guidelines, contribute it through a github pull request.


=== Create clean patches ===

When committing code to your git repo, it's easy to forget stuff: maybe you forget to add a new file, maybe you leave some debug code that you remove with a later commit, maybe you find spelling errors, and of course you will probably find bugs in the new code later, that needs to be fixed. This can all lead to a lot of commits in the style of:

"Fixed code I broke for other hardware"

and

"Fixed typo in new commutation implementation"

These types of commits just mess up the tree, and makes it hard to see what's actually been done to the code. Fortunately, there is a great tool in git that you can use to clean these up: 'git rebase -i <parent-hash>'! It's quite easy to use: once run, you get a list of all commits after <parent-hash>, and have the option to move commits around and also to squash them (make them as one). So you can group the "main" commit for a logical change together with all its "fix-the-code-I-broke" commits, and then squash them together to one, well functioning commit!

Please do this, so that each commit represents a logical, well-functioning change.

See INTERACTIVE MODE in 'man git-rebase' for detailed info. Here is a good article as well:
http://www.siliconfidential.com/articles/15-seconds-to-cleaner-git-history/


=== Describe the changes ===

In the commit messages, describe the technical detail of the change(s) you make.

Be as specific as possible. The WORST descriptions possible include things like "update bldc code", "bug fix for FOC", or "this patch includes updates for the observer. Please apply."

Your commit message(s) will end up in the commit log for the VESC firmware, and someone reading the log a year later should be able to infer what each commit does.


=== Coding Style ===

Make sure your coding style matches the style in the existing code. Among other things, that means:

* Use tabs for indentation (make sure your editor does not replace tabs with spaces). Never use spaces before tabs. Preferably use a tab width of 4.

* Place the opening brace '{' of code blocks on the same line as the preceding text, both after function headers and after control statements:

int main(void) {

and

if (send_func) {

* Always use braces, even for single-line blocks:

if (send_func) {
send_func(data, len);
}

* Write "else" on the same line as both the preceding and the following brace:

} else {

* Use C99-style single-line comments ("// ...", not "/* ... */"):

static mc_configuration mcconf, mcconf_old; // Static to save some stack space

and

// Lock the system and enter an infinite loop. The watchdog will reboot.

* If you write function comments, write them Doxygen-style.

* There is no limit on line length, so long lines in general should not be wrapped.

=== Make sure that all hardware versions and configuration variations work ===

When making updates it is easy to break things for different configurations. In order to make sure that the firmware at least builds for different hardwares and configurations it is a good idea to run the build_all/rebuild_all script and ensure that is finished without warnings and/or errors.


=== Be patient, and don't take criticism personally ===

Be prepared to have to rework your contribution several times before it is considered acceptable. Once code is in, it's difficult to get it reworked for better quality, so it's important that this is done before the code is even accepted. Don't take it personally; instead appreciate that it is this peer review that makes the code great in the end!



Thanks for reading!

4 changes: 2 additions & 2 deletions Makefile
Expand Up @@ -269,8 +269,8 @@ build/$(PROJECT).bin: build/$(PROJECT).elf

# Program
upload: build/$(PROJECT).bin
#qstlink2 --cli --erase --write build/$(PROJECT).bin
#openocd -f interface/stlink-v2.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x_stlink.cfg -c "program build/$(PROJECT).elf verify reset" # Older openocd
# qstlink2 --cli --erase --write build/$(PROJECT).bin
# openocd -f interface/stlink-v2.cfg -c "set WORKAREASIZE 0x2000" -f target/stm32f4x_stlink.cfg -c "program build/$(PROJECT).elf verify reset" # Older openocd
openocd -f board/stm32f4discovery.cfg -c "reset_config trst_only combined" -c "program build/$(PROJECT).elf verify reset exit" # For openocd 0.9

#program with olimex arm-usb-tiny-h and jtag-swd adapter board. needs openocd>=0.9
Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1 +1 @@
This is the source code for my custom BLDC controller. A complete description and tutorial about how to use it can be found here: http://vedder.se/2015/01/vesc-open-source-esc/
This is the source code for the VESC DC/BLDC/FOC controller. A description and tutorial about how to use it can be found here: http://vedder.se/2015/01/vesc-open-source-esc/
13 changes: 4 additions & 9 deletions appconf/appconf_custom.h
@@ -1,12 +1,14 @@
/*
Copyright 2016 Benjamin Vedder benjamin@vedder.se
This program is free software: you can redistribute it and/or modify
This file is part of the VESC firmware.
The VESC firmware is free software: you can redistribute it and/or modify
it 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.
This program is distributed in the hope that it will be useful,
The VESC firmware is distributed in the hope that it 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.
Expand All @@ -15,13 +17,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*
* appconf_example_ppm.h
*
* Created on: 9 sep 2015
* Author: benjamin
*/

#ifndef APPCONF_APPCONF_EXAMPLE_PPM_H_
#define APPCONF_APPCONF_EXAMPLE_PPM_H_

Expand Down
33 changes: 13 additions & 20 deletions appconf/appconf_default.h
@@ -1,12 +1,14 @@
/*
Copyright 2015 Benjamin Vedder benjamin@vedder.se
Copyright 2016 Benjamin Vedder benjamin@vedder.se
This program is free software: you can redistribute it and/or modify
This file is part of the VESC firmware.
The VESC firmware is free software: you can redistribute it and/or modify
it 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.
This program is distributed in the hope that it will be useful,
The VESC firmware is distributed in the hope that it 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.
Expand Down Expand Up @@ -63,12 +65,6 @@
#ifndef APPCONF_PPM_SAFE_START
#define APPCONF_PPM_SAFE_START true
#endif
#ifndef APPCONF_PPM_RPM_LIM_START
#define APPCONF_PPM_RPM_LIM_START 150000
#endif
#ifndef APPCONF_PPM_RPM_LIM_END
#define APPCONF_PPM_RPM_LIM_END 200000
#endif
#ifndef APPCONF_PPM_MULTI_ESC
#define APPCONF_PPM_MULTI_ESC false
#endif
Expand All @@ -92,6 +88,12 @@
#ifndef APPCONF_ADC_VOLTAGE_END
#define APPCONF_ADC_VOLTAGE_END 3.0
#endif
#ifndef APPCONF_ADC_VOLTAGE2_START
#define APPCONF_ADC_VOLTAGE2_START 0.9
#endif
#ifndef APPCONF_ADC_VOLTAGE2_END
#define APPCONF_ADC_VOLTAGE2_END 3.0
#endif
#ifndef APPCONF_ADC_USE_FILTER
#define APPCONF_ADC_USE_FILTER true
#endif
Expand All @@ -107,11 +109,8 @@
#ifndef APPCONF_ADC_VOLTAGE_INVERTED
#define APPCONF_ADC_VOLTAGE_INVERTED false
#endif
#ifndef APPCONF_ADC_RPM_LIM_START
#define APPCONF_ADC_RPM_LIM_START 150000.0
#endif
#ifndef APPCONF_ADC_RPM_LIM_END
#define APPCONF_ADC_RPM_LIM_END 200000.0
#ifndef APPCONF_ADC_VOLTAGE2_INVERTED
#define APPCONF_ADC_VOLTAGE2_INVERTED false
#endif
#ifndef APPCONF_ADC_MULTI_ESC
#define APPCONF_ADC_MULTI_ESC false
Expand All @@ -138,12 +137,6 @@
#ifndef APPCONF_CHUK_HYST
#define APPCONF_CHUK_HYST 0.15
#endif
#ifndef APPCONF_CHUK_RPM_LIM_START
#define APPCONF_CHUK_RPM_LIM_START 150000.0
#endif
#ifndef APPCONF_CHUK_RPM_LIM_END
#define APPCONF_CHUK_RPM_LIM_END 200000.0
#endif
#ifndef APPCONF_CHUK_RAMP_TIME_POS
#define APPCONF_CHUK_RAMP_TIME_POS 0.9
#endif
Expand Down
15 changes: 5 additions & 10 deletions appconf/appconf_example_ppm.h
@@ -1,12 +1,14 @@
/*
Copyright 2015 Benjamin Vedder benjamin@vedder.se
Copyright 2016 Benjamin Vedder benjamin@vedder.se
This program is free software: you can redistribute it and/or modify
This file is part of the VESC firmware.
The VESC firmware is free software: you can redistribute it and/or modify
it 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.
This program is distributed in the hope that it will be useful,
The VESC firmware is distributed in the hope that it 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.
Expand All @@ -15,13 +17,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*
* appconf_example_ppm.h
*
* Created on: 9 sep 2015
* Author: benjamin
*/

#ifndef APPCONF_APPCONF_EXAMPLE_PPM_H_
#define APPCONF_APPCONF_EXAMPLE_PPM_H_

Expand Down
58 changes: 28 additions & 30 deletions applications/app.c
@@ -1,25 +1,21 @@
/*
Copyright 2012-2014 Benjamin Vedder benjamin@vedder.se
Copyright 2016 Benjamin Vedder benjamin@vedder.se
This program is free software: you can redistribute it and/or modify
This file is part of the VESC firmware.
The VESC firmware is free software: you can redistribute it and/or modify
it 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.
This program is distributed in the hope that it will be useful,
The VESC firmware is distributed in the hope that it 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 program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* app.c
*
* Created on: 18 apr 2014
* Author: benjamin
*/
*/

#include "app.h"
#include "ch.h"
Expand All @@ -31,12 +27,28 @@
// Private variables
static app_configuration appconf;

void app_init(app_configuration *conf) {
app_set_configuration(conf);
const app_configuration* app_get_configuration(void) {
return &appconf;
}

/**
* Reconfigure and restart all apps. Some apps don't have any configuration options.
*
* @param conf
* The new configuration to use.
*/
void app_set_configuration(app_configuration *conf) {
appconf = *conf;

#ifdef HW_HAS_PERMANENT_NRF
nrf_driver_init();
rfhelp_restart();
app_ppm_stop();
app_adc_stop();
app_uartcomm_stop();
app_nunchuk_stop();
#ifndef HW_HAS_PERMANENT_NRF
nrf_driver_stop();
#endif
#ifdef USE_APP_STEN
app_sten_stop();
#endif

switch (appconf.app_to_use) {
Expand Down Expand Up @@ -79,28 +91,14 @@ void app_init(app_configuration *conf) {
case APP_CUSTOM:
#ifdef USE_APP_STEN
hw_stop_i2c();
app_sten_init();
app_sten_start();
#endif
break;

default:
break;
}
}

const app_configuration* app_get_configuration(void) {
return &appconf;
}

/**
* Reconfigure all apps. Note that this will not start apps that are not already running, that
* should be done at boot. Some apps don't have any configuration options.
*
* @param conf
* The new configuration to use.
*/
void app_set_configuration(app_configuration *conf) {
appconf = *conf;
app_ppm_configure(&appconf.app_ppm_conf);
app_adc_configure(&appconf.app_adc_conf);
app_uartcomm_configure(appconf.app_uart_baudrate);
Expand Down

0 comments on commit 5dbc94c

Please sign in to comment.