diff --git a/Makefile b/Makefile index d352ad2..633d69a 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,13 @@ CPPFLAGS = -Os -ggdb3 -Wall -Wextra -Iinclude/ -Ilibopeninv/include -Ilibopen -fno-common -std=c++11 -pedantic -DSTM32F1 -DT_DEBUG=$(TERMINAL_DEBUG) \ -DCONTROL=CTRL_$(CONTROL) -DCTRL_SINE=0 -DCTRL_FOC=1 \ -ffunction-sections -fdata-sections -fno-builtin -fno-rtti -fno-exceptions -fno-unwind-tables -mcpu=cortex-m3 -mthumb + +# Check if the variable GITHUB_RUN_NUMBER exists. When running on the github actions running, this +# variable is automatically available. +# Create a compiler define with the content of the variable. Or, if it does not exist, use replacement value 99999. +EXTRACOMPILERFLAGS = $(shell \ + if [ -z "$$GITHUB_RUN_NUMBER" ]; then echo "-DGITHUB_RUN_NUMBER=0"; else echo "-DGITHUB_RUN_NUMBER=$$GITHUB_RUN_NUMBER"; fi ) + LDSCRIPT = stm32_sine.ld LDFLAGS = -Llibopencm3/lib -ggdb3 -T$(LDSCRIPT) -march=armv7 -nostartfiles -Wl,--gc-sections,-Map,linker.map OBJSL = stm32_sine.o hwinit.o stm32scheduler.o params.o terminal.o terminal_prj.o \ @@ -116,7 +123,7 @@ $(OUT_DIR)/%.o: %.c Makefile $(OUT_DIR)/%.o: %.cpp Makefile @printf " CPP $(subst $(shell pwd)/,,$(@))\n" - $(Q)$(CPP) $(CPPFLAGS) -MMD -MP -o $@ -c $< + $(Q)$(CPP) $(CPPFLAGS) $(EXTRACOMPILERFLAGS) -MMD -MP -o $@ -c $< clean: @printf " CLEAN ${OUT_DIR}\n" diff --git a/include/param_prj.h b/include/param_prj.h index a69cff7..959d3ad 100644 --- a/include/param_prj.h +++ b/include/param_prj.h @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -#define VER 5.33.R +#define VERSION 5.34 /* Entries should be ordered as follows: 1. Saveable parameters @@ -295,10 +295,20 @@ #define CAN_PERIOD_100MS 0 #define CAN_PERIOD_10MS 1 +#define PARAM_ID_SUM_START_OFFSET GITHUB_RUN_NUMBER + +#if GITHUB_RUN_NUMBER == 0 //local build +#define VER(G) VERSION.R +#else //github runner build +#define VER(G) VERSION.##G.B +#endif + +#define VER2(G) VER(G) + #if CONTROL == CTRL_SINE -#define VERSTR STRINGIFY(4=VER-sine) +#define VERSTR STRINGIFY(4=VER2(GITHUB_RUN_NUMBER)-sine) #elif CONTROL == CTRL_FOC -#define VERSTR STRINGIFY(4=VER-foc) +#define VERSTR STRINGIFY(4=VER2(GITHUB_RUN_NUMBER)-foc) #endif // CONTROL enum cruisemodes diff --git a/libopeninv b/libopeninv index fecf294..637f16c 160000 --- a/libopeninv +++ b/libopeninv @@ -1 +1 @@ -Subproject commit fecf2943b2ca44adca25af22dfcf46f32845af0d +Subproject commit 637f16cc464277aab2a86f911a8d26a5cfb8f47f diff --git a/src/pwmgeneration.cpp b/src/pwmgeneration.cpp index 3e7b0ad..9ac370c 100644 --- a/src/pwmgeneration.cpp +++ b/src/pwmgeneration.cpp @@ -424,6 +424,10 @@ uint16_t PwmGeneration::TimerSetup(uint16_t deadtime, bool activeLow) timer_set_break_polarity_high(PWM_TIMER); timer_enable_break(PWM_TIMER); + + if (hwRev == HW_PRIUS && Param::GetInt(Param::ocurlim) == -1) + timer_disable_break(PWM_TIMER); + timer_set_enabled_off_state_in_run_mode(PWM_TIMER); timer_set_enabled_off_state_in_idle_mode(PWM_TIMER); timer_set_deadtime(PWM_TIMER, deadtime);