Skip to content

Commit b73bc8c

Browse files
committed
update for v1.12.1
1 parent 4b53920 commit b73bc8c

13 files changed

Lines changed: 133 additions & 18 deletions

File tree

.github/workflows/build-firmware.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ jobs:
6363
cd /opt/esp/idf
6464
git checkout c29343eb94d
6565
git submodule update --init --recursive
66+
git status
6667
tools/idf_tools.py --non-interactive install cmake
6768
./install.sh
6869
source ./export.sh

Firmware/FFBoard/Inc/OutputPin.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class OutputPin {
3737
return(this->port == b.port && this->pin == b.pin);
3838
}
3939

40+
#pragma GCC diagnostic push
41+
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
4042
/**
4143
* Sets a pin into output mode in case it was previously reconfigured
4244
*/
@@ -48,7 +50,7 @@ class OutputPin {
4850
GPIO_InitStruct.Speed = speed;
4951
HAL_GPIO_Init(port, &GPIO_InitStruct);
5052
}
51-
53+
#pragma GCC diagnostic pop
5254
//const std::string getName(){return name;}
5355

5456

Firmware/FFBoard/Src/flash_helpers.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ bool Flash_Write(uint16_t adr,uint16_t dat){
2525
bool res = false;
2626
if(readRes == 1 || (readRes == 0 && buf != dat) ){ // Only write if var updated
2727
HAL_FLASH_Unlock();
28+
#ifndef HW_ESP32SX
2829
// Clear all the error flags
2930
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
3031
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPERR);
3132
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_WRPERR);
3233
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGAERR);
3334
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGPERR);
3435
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGSERR);
36+
#endif
3537
if(EE_WriteVariable(adr, dat) == HAL_OK){
3638
res = true;
3739
}
@@ -60,13 +62,15 @@ bool Flash_ReadWriteDefault(uint16_t adr,uint16_t *buf,uint16_t def){
6062
if(EE_ReadVariable(adr, buf) != 0){
6163
*buf = def;
6264
HAL_FLASH_Unlock();
65+
#ifndef HW_ESP32SX
6366
// Clear all the error flags
6467
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_EOP);
6568
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPERR);
6669
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_WRPERR);
6770
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGAERR);
6871
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGPERR);
6972
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_PGSERR);
73+
#endif
7074
EE_WriteVariable(adr, def);
7175
HAL_FLASH_Lock();
7276
return false;

Firmware/FFBoard/UserExtensions/Inc/TMC4671.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@
3232
#ifdef HW_ESP32SX
3333
#define TMC_THREAD_MEM 4096
3434
#define TMC_THREAD_PRIO 25*25/56
35+
#define TMCENC_THREAD_MEM 2048
36+
#define TMCENC_THREAD_PRIO 33*25/56
3537
#else
3638
#define TMC_THREAD_MEM 256
3739
#define TMC_THREAD_PRIO 25 // Must be higher than main thread
40+
#define TMCENC_THREAD_MEM 80
41+
#define TMCENC_THREAD_PRIO 33
3842
#endif
3943

4044
#define TMC_ADCOFFSETFAIL 5000 // How much offset from 0x7fff to allow before a calibration is failed

Firmware/FFBoard/UserExtensions/Src/TMC4671.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2996,7 +2996,7 @@ void TMC4671::setUpExtEncTimer(){
29962996
/**
29972997
* Medium priority task to update external encoders
29982998
*/
2999-
TMC4671::TMC_ExternalEncoderUpdateThread::TMC_ExternalEncoderUpdateThread(TMC4671* tmc) : cpp_freertos::Thread("TMCENC",80,33),tmc(tmc){
2999+
TMC4671::TMC_ExternalEncoderUpdateThread::TMC_ExternalEncoderUpdateThread(TMC4671* tmc) : cpp_freertos::Thread("TMCENC",TMCENC_THREAD_MEM,TMCENC_THREAD_PRIO),tmc(tmc){
30003000
this->Start();
30013001
}
30023002

-57.5 KB
Binary file not shown.
-57.5 KB
Binary file not shown.
-59.7 KB
Binary file not shown.

Firmware/Targets/ESP32SX/main/cpp_target_config.cpp

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,25 @@ CANPort canport{CANPORT};
4242

4343
#ifdef PWMDRIVER
4444
// CCR and channels must match!
45-
const PWMConfig pwmTimerConfig = {
46-
.channel_1 = TIM_CHANNEL_1,
47-
.channel_2 = TIM_CHANNEL_2,
48-
.channel_3 = TIM_CHANNEL_3,
49-
.channel_4 = TIM_CHANNEL_4,
50-
51-
.ccr_1 = 1,
52-
.ccr_2 = 2,
53-
.ccr_3 = 3,
54-
.ccr_4 = 4,
55-
56-
.timer = &TIM_PWM,
57-
.timerFreq = APB_CLK_FREQ
58-
};
45+
const PWMConfig pwmTimerConfig =
46+
{
47+
.channel_1 = TIM_CHANNEL_1,
48+
.channel_2 = TIM_CHANNEL_2,
49+
.channel_3 = TIM_CHANNEL_3,
50+
.channel_4 = TIM_CHANNEL_4,
51+
52+
.pwm_chan = 1,
53+
.dir_chan = 3,
54+
.dir_chan_n = 4,
55+
56+
.centerpwm_chan = 1,
57+
58+
.rcpwm_chan = 1,
59+
60+
.dualpwm1 = 1,
61+
.dualpwm2 = 2,
62+
63+
.timer = &TIM_PWM,
64+
.timerFreq = APB_CLK_FREQ
65+
};
5966
#endif

Firmware/Targets/ESP32SX/main/glue.c

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
static const char *TAG = "glue";
1515

1616
ADC_HandleTypeDef hadc1;
17-
ADC_HandleTypeDef hadc2;
1817
SPI_HandleTypeDef hspi1;
1918
#if defined(SHIFTERBUTTONS) || defined(SPIBUTTONS)
2019
SPI_HandleTypeDef hspi2;
@@ -25,6 +24,20 @@ CAN_HandleTypeDef hcan1;
2524
TIM_HandleTypeDef htim1;
2625
I2C_HandleTypeDef hi2c1;
2726

27+
28+
void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
29+
{
30+
gpio_config_t io_conf = {0};
31+
io_conf.intr_type = GPIO_INTR_DISABLE;
32+
io_conf.mode = GPIO_Init->Mode;
33+
io_conf.pin_bit_mask = (BIT64(LED_CLIP_Pin) | BIT64(LED_ERR_Pin) \
34+
| BIT64(LED_SYS_Pin) | BIT64(DRV_ENABLE_Pin) \
35+
| BIT64(DRV_BRAKE_Pin) | BIT64(CAN_S_Pin));
36+
io_conf.pull_down_en = 0;
37+
io_conf.pull_up_en = 0;
38+
gpio_config(&io_conf);
39+
}
40+
2841
GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin)
2942
{
3043
return gpio_ll_get_level(&GPIO, GPIO_Pin);
@@ -125,7 +138,7 @@ HAL_StatusTypeDef HAL_SPI_Init(SPI_HandleTypeDef *hspi)
125138
.sclk_io_num = SPI1_SCK_Pin,
126139
.quadwp_io_num = -1,
127140
.quadhd_io_num = -1,
128-
.max_transfer_sz = 256,
141+
.max_transfer_sz = 4096,
129142
};
130143
hspi->Init.BaudRatePrescaler >>= 3;
131144
uint32_t freq = (84 * 1000 * 1000) / (uint32_t)(powf(2, hspi->Init.BaudRatePrescaler + 1));
@@ -158,6 +171,11 @@ HAL_StatusTypeDef HAL_SPI_Transmit(SPI_HandleTypeDef *hspi, uint8_t *pData, uint
158171
return HAL_OK;
159172
}
160173

174+
HAL_StatusTypeDef HAL_SPI_Transmit_DMA(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size)
175+
{
176+
return HAL_SPI_Transmit(hspi, pData, Size, 500);
177+
}
178+
161179
HAL_StatusTypeDef HAL_SPI_Transmit_IT(SPI_HandleTypeDef *hspi, uint8_t *pData, uint16_t Size)
162180
{
163181
ESP_LOGW(TAG, "%s: Unsupported", __FUNCTION__);
@@ -216,6 +234,21 @@ HAL_StatusTypeDef HAL_UART_Receive(UART_HandleTypeDef *huart, uint8_t *pData, ui
216234
ESP_LOGW(TAG, "%s: Unsupported", __FUNCTION__);
217235
return HAL_OK;
218236
}
237+
HAL_StatusTypeDef HAL_UART_Receive_DMA(UART_HandleTypeDef *huart, uint8_t *pData, uint16_t Size)
238+
{
239+
ESP_LOGW(TAG, "%s: Unsupported", __FUNCTION__);
240+
return HAL_OK;
241+
}
242+
HAL_StatusTypeDef HAL_UART_AbortReceive(UART_HandleTypeDef *huart)
243+
{
244+
ESP_LOGW(TAG, "%s: Unsupported", __FUNCTION__);
245+
return HAL_OK;
246+
}
247+
HAL_StatusTypeDef HAL_UART_AbortTransmit(UART_HandleTypeDef *huart)
248+
{
249+
ESP_LOGW(TAG, "%s: Unsupported", __FUNCTION__);
250+
return HAL_OK;
251+
}
219252

220253
HAL_StatusTypeDef HAL_I2C_Init(I2C_HandleTypeDef *hi2c)
221254
{

0 commit comments

Comments
 (0)