Skip to content

Commit

Permalink
Fixed some bugs (see Readme.md)
Browse files Browse the repository at this point in the history
  • Loading branch information
thankthemaker committed Jul 20, 2021
1 parent f0b66f6 commit aefeb93
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 9 deletions.
19 changes: 17 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
# Changelog for rESCue firmware

## Release 1.3.4 (not released yet)

### 20.07.2021

- fixed WiFi OTA update by changing partition schema to default
- fixed "Guru Meditation Error: Core 1 panic'ed (Cache disabled but cached memory region accessed)" while OTA
- fixed app crash when App-Configuration is written and not dividable by 6 byte

## Release 1.3.3

### 19.07.2021

- improved CANBUS communication
- Fixed bug that CANBUS freezes when sending multiple frames at the same time

## Release 1.3.1

- bugfix lights, erpm was read wrong sometimes

## Release 1.3.0

### 27.06.2021
### 27.06.2021

- prepared release 1.3.0
- prepared release 1.3.0

### 25.06.2021

Expand Down
6 changes: 6 additions & 0 deletions default.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x140000,
app1, app, ota_1, 0x150000,0x140000,
spiffs, data, spiffs, 0x290000,0x170000,
4 changes: 2 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ board = wemos_d1_mini32
framework = arduino
monitor_speed = 115200
upload_Speed = 921600
board_build.partitions = min_spiffs.csv
board_build.partitions = default.csv
lib_deps =
${common_env_data.lib_deps_external}
build_flags =
Expand All @@ -55,7 +55,7 @@ platform = espressif32
board = nodemcu-32s
framework = arduino
monitor_speed = 115200
board_build.partitions = min_spiffs.csv
board_build.partitions = default.csv
lib_deps =
${common_env_data.lib_deps_external}
build_flags =
Expand Down
9 changes: 7 additions & 2 deletions src/CanBus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,9 @@ void CanBus::proxyIn(std::string in) {
tx_frame.MsgID = (uint32_t(0x8000) << 16) + (uint16_t(CAN_PACKET_FILL_RX_BUFFER) << 8) + VESC_CAN_ID;
tx_frame.FIR.B.DLC = 8;
tx_frame.data.u8[0] = byteNum - offset; //startbyte counter of frame
for (int i = 1; i < 8; i++) {

int sendLen = (longPackBuffer.length() >= byteNum + 7) ? 7 : longPackBuffer.length() - byteNum;
for (int i = 1; i<sendLen+1; i++) {
//Serial.printf("Reading byte %d, length %d\n", byteNum + i, longPackBuffer.length());
tx_frame.data.u8[i] = (uint8_t) longPackBuffer.at(byteNum + i);
}
Expand All @@ -375,10 +377,13 @@ void CanBus::proxyIn(std::string in) {
tx_frame.FIR.B.DLC = 8;
tx_frame.data.u8[0] = (byteNum - 1) >> 8;
tx_frame.data.u8[1] = (byteNum - 1) & 0xFF;
for (int i=2; i<8; i++) {

int sendLen = (longPackBuffer.length() >= byteNum + 6) ? 6 : longPackBuffer.length() - byteNum;
for (int i=2; i<sendLen+2; i++) {
//Serial.printf("Reading byte %d, length %d\n", byteNum + i, longPackBuffer.length());
tx_frame.data.u8[i] = (uint8_t) longPackBuffer.at(byteNum + i);
}

sendCanFrame(&tx_frame);
}

Expand Down
4 changes: 2 additions & 2 deletions src/OTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ void startUpdate() {
Serial.println("partition size:" + String(partition->size));
esp_ota_begin(partition, OTA_SIZE_UNKNOWN, &otaHandler);
updateFlag = true;
Serial.println("Update started");
}

void handleUpdate(std::string data) {
Expand Down Expand Up @@ -65,7 +66,7 @@ void activateWiFiAp(const char *password) {
AsyncWebParameter* p = request->getParam(i);
if(p->isPost() && p->name().compareTo("data") != -1) {
const char *value =p->value().c_str();
Serial.printf("\nPOST[%s]: bytes %d\n", p->name().c_str(), p->value().length());
//Serial.printf("\nPOST[%s]: bytes %d\n", p->name().c_str(), p->value().length());
if(!updateFlag) {
startUpdate();
}
Expand Down Expand Up @@ -107,7 +108,6 @@ void OTAUpdater::setup() {
printf("Type: %02x SubType %02x Address 0x%06X Size 0x%06X Encryption %i Label %s\r\n", _mypart->type, _mypart->subtype, _mypart->address, _mypart->size, _mypart->encrypted, _mypart->label);
_mypartiterator = esp_partition_next(_mypartiterator);
}

_mypart = esp_ota_get_boot_partition();
printf("Current active partition is %s\r\n", _mypart->label);
}
Expand Down
4 changes: 3 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,15 @@ void setup() {
}

AppConfiguration::getInstance()->readPreferences();
ledController = LedControllerFactory::getInstance()->createLedController();

if(AppConfiguration::getInstance()->config.otaUpdateActive) {
updater->setup();
return;
}

ledController = LedControllerFactory::getInstance()->createLedController();


pinMode(PIN_FORWARD, INPUT);
pinMode(PIN_BACKWARD, INPUT);
pinMode(PIN_BRAKE, INPUT);
Expand Down

0 comments on commit aefeb93

Please sign in to comment.