Skip to content

Commit f4c1b2c

Browse files
committed
bugfix: fix crash for esp32s2
1 parent ebb8eef commit f4c1b2c

7 files changed

Lines changed: 16 additions & 9 deletions

File tree

Firmware/FFBoard/Inc/DebugLog.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@ extern "C" {
1111
// LOG DEBUG
1212
#ifdef HW_ESP32SX
1313
#define FFB_LOGI(format, ...) do { \
14-
ESP_LOGI(__FILE__, "%s(%d): " format, __FUNCTION__, __LINE__ __VA_OPT__(,) __VA_ARGS__); \
14+
ESP_LOGI(__FUNCTION__, "%s:%d -- " format, __FILE__, __LINE__ __VA_OPT__(,) __VA_ARGS__); \
1515
} while(0)
1616
#define FFB_LOGW(format, ...) do { \
17-
ESP_LOGW(__FILE__, "%s(%d): " format, __FUNCTION__, __LINE__ __VA_OPT__(,) __VA_ARGS__); \
17+
ESP_LOGW(__FUNCTION__, "%s:%d -- " format, __FILE__, __LINE__ __VA_OPT__(,) __VA_ARGS__); \
1818
} while(0)
1919
#define FFB_LOGE(format, ...) do { \
20-
ESP_LOGE(__FILE__, "%s(%d): " format, __FUNCTION__, __LINE__ __VA_OPT__(,) __VA_ARGS__); \
20+
ESP_LOGE(__FUNCTION__, "%s:%d -- " format, __FILE__, __LINE__ __VA_OPT__(,) __VA_ARGS__); \
2121
} while(0)
2222
#define FFB_LOGD(format, ...) do { \
23-
ESP_LOGD(__FILE__, "%s(%d): " format, __FUNCTION__, __LINE__ __VA_OPT__(,) __VA_ARGS__); \
23+
ESP_LOGD(__FUNCTION__, "%s:%d -- " format, __FILE__, __LINE__ __VA_OPT__(,) __VA_ARGS__); \
2424
} while(0)
2525

2626
#else

Firmware/FFBoard/Src/CDCcomm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CDCcomm::~CDCcomm() {
3131
void CDCcomm::cdcFinished(uint8_t itf){
3232
bool ret = cdcSems[itf].Give();
3333
if (true != ret){
34-
FFB_LOGE("cdcSem give error\n");
34+
// FFB_LOGE("cdcSem give error\n");
3535
return;
3636
}
3737

Firmware/FFBoard/Src/EffectsCalculator.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const ClassIdentifier EffectsCalculator::getInfo(){
2929
EffectsCalculator::EffectsCalculator() : CommandHandler("fx", CLSID_EFFECTSCALC),
3030
Thread("EffectsCalculator", EFFECT_THREAD_MEM, EFFECT_THREAD_PRIO)
3131
{
32-
restoreFlash();
3332

3433
CommandHandler::registerCommands();
3534
registerCommand("filterCfFreq", EffectsCalculator_commands::ffbfiltercf, "Constant force filter frequency", CMDFLAG_GET | CMDFLAG_SET);
@@ -576,7 +575,12 @@ uint8_t EffectsCalculator::getGain() { return global_gain; }
576575

577576
void EffectsCalculator::setEffectsArray(FFB_Effect *pEffects)
578577
{
579-
effects = pEffects;
578+
FFB_LOGI("setEffectsArray %p", pEffects);
579+
if (effects != pEffects) {
580+
effects = pEffects;
581+
FFB_LOGI("restoreFlash");
582+
restoreFlash();
583+
}
580584
}
581585

582586

Firmware/FFBoard/Src/eeprom.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,11 @@ uint16_t EE_ReadVariable(uint16_t VirtAddress, uint16_t *Data)
168168
char key[16] = {0};
169169
make_key(VirtAddress, key);
170170
esp_err_t ret = param_load(_VAL_NAMESPACE, key, Data);
171-
ESP_LOGI(TAG, "read nvs %s=%d", key, *Data);
172-
171+
if (ESP_OK == ret) {
172+
ESP_LOGI(TAG, "read nvs %s=%d", key, *Data);
173+
} else {
174+
ESP_LOGE(TAG, "read nvs %s error", key);
175+
}
173176
/* Return ReadStatus value: (0: variable exist, 1: variable doesn't exist) */
174177
return ret == ESP_OK ? 0 : 1;
175178
}
-2.3 KB
Binary file not shown.
-2.3 KB
Binary file not shown.
-1.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)