Skip to content

Commit dd39862

Browse files
committed
Merge remote-tracking branch 'remote-rusefi/master' into rusefi-master
2 parents 82aa512 + acd0463 commit dd39862

36 files changed

Lines changed: 1482 additions & 1430 deletions

firmware/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ endif
2323

2424
# C++ specific options here (added to USE_OPT).
2525
ifeq ($(USE_CPPOPT),)
26-
USE_CPPOPT = -fno-rtti -fno-exceptions -ffast-math -funsafe-math-optimizations -fno-threadsafe-statics -fno-use-cxa-atexit -std=c++17
26+
USE_CPPOPT = -fno-rtti -fno-exceptions -ffast-math -funsafe-math-optimizations -fno-threadsafe-statics -fno-use-cxa-atexit -std=c++20
2727
endif
2828

2929
# Enable this if you want the linker to remove unused code and data.
@@ -151,7 +151,7 @@ CPPSRC = $(ALLCPPSRC) \
151151
can.cpp \
152152
can_helper.cpp \
153153
can_aemnet.cpp \
154-
fault.cpp \
154+
status.cpp \
155155
lambda_conversion.cpp \
156156
pwm.cpp \
157157
dac.cpp \

firmware/boards/f0_module/board.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,10 +165,12 @@
165165
* GPIOA setup:
166166
*
167167
* PA0 - Un_sense (analog in).
168-
* PA1 - Vm_sense (analog in).
168+
* PA1 - LSU_vm (analog in).
169169
* PA2 - Ip_sense (analog in).
170+
* PA3 - Vm_sense (analog in).
170171
* PA6 - Ip_dac (PWM) (output pushpull, alternate 1).
171172
* PA7 - Heater PWM (output pushpull, alternate 2).
173+
* PA8 - SEL2 (digital input)
172174
* PA9 - UART TX (alternate 1).
173175
* PA10 - UART RX (alternate 1).
174176
* PA11 - CAN RX (alternate 4).
@@ -179,19 +181,19 @@
179181
*/
180182
#define VAL_GPIOA_MODER (PIN_MODE_ANALOG(GPIOA_PIN0) | \
181183
PIN_MODE_ANALOG(GPIOA_PIN1) | \
182-
PIN_MODE_ANALOG(GPIOA_PIN2) | \
183-
PIN_MODE_INPUT(GPIOA_PIN3) | \
184-
PIN_MODE_INPUT(GPIOA_PIN4) | \
185-
PIN_MODE_INPUT(GPIOA_PIN5) | \
186-
PIN_MODE_ALTERNATE(GPIOA_PIN6) | \
187-
PIN_MODE_ALTERNATE(GPIOA_PIN7) | \
188-
PIN_MODE_INPUT(GPIOA_PIN8) | \
189-
PIN_MODE_ALTERNATE(GPIOA_PIN9) | \
190-
PIN_MODE_ALTERNATE(GPIOA_PIN10) | \
191-
PIN_MODE_ALTERNATE(GPIOA_PIN11) | \
192-
PIN_MODE_ALTERNATE(GPIOA_PIN12) | \
193-
PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
194-
PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
184+
PIN_MODE_ANALOG(GPIOA_PIN2) | \
185+
PIN_MODE_ANALOG(GPIOA_PIN3) | \
186+
PIN_MODE_INPUT(GPIOA_PIN4) | \
187+
PIN_MODE_INPUT(GPIOA_PIN5) | \
188+
PIN_MODE_ALTERNATE(GPIOA_PIN6) | \
189+
PIN_MODE_ALTERNATE(GPIOA_PIN7) | \
190+
PIN_MODE_INPUT(GPIOA_PIN8) | \
191+
PIN_MODE_ALTERNATE(GPIOA_PIN9) | \
192+
PIN_MODE_ALTERNATE(GPIOA_PIN10) | \
193+
PIN_MODE_ALTERNATE(GPIOA_PIN11) | \
194+
PIN_MODE_ALTERNATE(GPIOA_PIN12) | \
195+
PIN_MODE_ALTERNATE(GPIOA_SWDIO) | \
196+
PIN_MODE_ALTERNATE(GPIOA_SWCLK) | \
195197
PIN_MODE_ALTERNATE(GPIOA_PIN15))
196198
#define VAL_GPIOA_OTYPER (PIN_OTYPE_PUSHPULL(GPIOA_PIN0) | \
197199
PIN_OTYPE_PUSHPULL(GPIOA_PIN1) | \

firmware/boards/f0_module/bootloader/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ endif
1717

1818
# C++ specific options here (added to USE_OPT).
1919
ifeq ($(USE_CPPOPT),)
20-
USE_CPPOPT = -fno-rtti -fno-exceptions -ffast-math -funsafe-math-optimizations -fno-threadsafe-statics -fno-use-cxa-atexit -std=c++17
20+
USE_CPPOPT = -fno-rtti -fno-exceptions -ffast-math -funsafe-math-optimizations -fno-threadsafe-statics -fno-use-cxa-atexit -std=c++20
2121
endif
2222

2323
# Enable this if you want the linker to remove unused code and data.

firmware/boards/f0_module/bootloader/bootloader.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,16 +154,16 @@ void RunBootloaderLoop()
154154
// y = opcode
155155
// zzzz = extra 2 data bytes hidden in the address!
156156

157-
uint16_t header = frame.EID >> 20;
157+
uint16_t header = WB_MSG_GET_HEADER(frame.EID);
158158

159159
// All rusEfi bootloader packets start with 0x0EF, ignore other traffic on the bus
160160
if (header != WB_BL_HEADER)
161161
{
162162
continue;
163163
}
164164

165-
uint8_t opcode = (frame.EID >> 16) & 0x0F;
166-
uint16_t embeddedData = frame.EID & 0xFFFF;
165+
uint8_t opcode = WB_MSG_GET_OPCODE(frame.EID);
166+
uint16_t embeddedData = WB_MSG_GET_EXTRA(frame.EID);
167167

168168
switch (opcode) {
169169
case WB_OPCODE_START: // opcode 0 is simply the "enter BL" command, but we're already here. Send an ack.
@@ -182,7 +182,7 @@ void RunBootloaderLoop()
182182
}
183183

184184
break;
185-
case 0x02: // opcode 2 is "write flash data"
185+
case WB_OPCODE_DATA: // opcode 2 is "write flash data"
186186
// Embedded data is the flash address
187187

188188
// Don't allow misaligned writes

firmware/boards/f0_module/chconf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@
563563
* @note The default is @p FALSE.
564564
*/
565565
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
566-
#define CH_DBG_SYSTEM_STATE_CHECK FALSE
566+
#define CH_DBG_SYSTEM_STATE_CHECK TRUE
567567
#endif
568568

569569
/**

firmware/boards/f0_module/port.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ static chibios_rt::BinarySemaphore adcDoneSemaphore(/* taken =*/ true);
1919

2020
static void adcDoneCallback(ADCDriver*)
2121
{
22-
adcDoneSemaphore.signal();
22+
chSysLockFromISR();
23+
adcDoneSemaphore.signalI();
24+
chSysUnlockFromISR();
2325
}
2426

2527
const ADCConversionGroup convGroup =

firmware/boards/f1_dual/port.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ static chibios_rt::BinarySemaphore adcDoneSemaphore(/* taken =*/ true);
2020

2121
static void adcDoneCallback(ADCDriver*)
2222
{
23-
adcDoneSemaphore.signal();
23+
chSysLockFromISR();
24+
adcDoneSemaphore.signalI();
25+
chSysUnlockFromISR();
2426
}
2527

2628
const ADCConversionGroup convGroup =

firmware/boards/f1_dual/wideband_board_config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
// *******************************
2424
// 100K + 10K divider
2525
#define BATTERY_INPUT_DIVIDER (10.0 / (10.0 + 100.0))
26+
#define BOARD_HAS_VOLTAGE_SENSE
2627

2728
// *******************************
2829
// Heater low side Sensing

firmware/boards/f1_dual_rev1/port.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ static chibios_rt::BinarySemaphore adcDoneSemaphore(/* taken =*/ true);
2020

2121
static void adcDoneCallback(ADCDriver*)
2222
{
23-
adcDoneSemaphore.signal();
23+
chSysLockFromISR();
24+
adcDoneSemaphore.signalI();
25+
chSysUnlockFromISR();
2426
}
2527

2628
const ADCConversionGroup convGroup =

firmware/boards/f1_dual_rev1/wideband_board_config.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
// *******************************
2929
// 100K + 10K divider
3030
#define BATTERY_INPUT_DIVIDER (10.0 / (10.0 + 100.0))
31+
#define BOARD_HAS_VOLTAGE_SENSE
3132

3233
// *******************************
3334
// Heater low side Sensing

0 commit comments

Comments
 (0)