small fixes

This commit is contained in:
Nic Limper
2023-03-28 16:39:28 +02:00
parent 7bd0c8c815
commit bf66a49038
3 changed files with 20 additions and 17 deletions

View File

@@ -16,7 +16,7 @@
#define FLASHER_AP_MOSI 7
#define FLASHER_AP_MISO 6
#define FLASHER_AP_RESET 15
#define FLASHER_AP_POWER 0
#define FLASHER_AP_POWER 0 //switching LOW side; connect to GND of tag
#define FLASHER_AP_TXD 16
#define FLASHER_AP_RXD 18
#define FLASHER_AP_TEST 17
@@ -51,7 +51,7 @@
#define FLASHER_AP_MOSI 23
#define FLASHER_AP_MISO 19
#define FLASHER_AP_RESET 2
#define FLASHER_AP_POWER 13
#define FLASHER_AP_POWER 13 // switching HIGH side; connect to 3V3 of tag
#define FLASHER_AP_POWER2 15
#define FLASHER_AP_TEST -1
#define FLASHER_AP_TXD 17

View File

@@ -154,10 +154,12 @@ void writeFlashBlock(uint16_t size) {
}
}
if (i == MAX_WRITE_ATTEMPTS) {
Serial.printf("\nFailed to write byte at c\n");
Serial.printf("x");
} else {
Serial.printf(".");
}
if (c % 256 == 0) {
Serial.printf("\rNow flashing, %d/%d...", c, size);
Serial.printf("\rNow flashing, %d/%d ", c, size);
vTaskDelay(1 / portTICK_PERIOD_MS);
}
}
@@ -168,12 +170,6 @@ bool performDeviceFlash() {
uint8_t interfaceWorking = 0;
zbs = new ZBS_interface;
interfaceWorking = zbs->begin(FLASHER_AP_SS, FLASHER_AP_CLK, FLASHER_AP_MOSI, FLASHER_AP_MISO, FLASHER_AP_RESET, FLASHER_AP_POWER, 8000000);
Serial.printf("Power cycling to get everything up and running...\n");
zbs->set_power(0);
vTaskDelay(500 / portTICK_PERIOD_MS);
zbs->set_power(1);
vTaskDelay(500 / portTICK_PERIOD_MS);
if (!interfaceWorking) {
Serial.print("I wasn't able to connect to a ZBS tag, please check wiring and definitions in the settings.h file.\n");
delete zbs;

View File

@@ -354,13 +354,20 @@ void zbsRxTask(void* parameter) {
wsLog("AP doesn't respond... " + String(crashcounter + 1));
if (++crashcounter >= 4) {
crashcounter = 0;
Serial.println("I wasn't able to connect to a ZBS tag, trying to reboot the tag.");
Serial.println("If this problem persists, please check wiring and definitions in the settings.h file, and presence of the right firmware");
rampTagPower(FLASHER_AP_POWER, false);
vTaskDelay(2 / portTICK_PERIOD_MS);
rampTagPower(FLASHER_AP_POWER, true);
wsErr("The AP tag crashed. Restarting tag, regenerating all pending info.");
refreshAllPending();
if (firstrun) {
Serial.println("I wasn't able to connect to a ZBS tag.");
Serial.println("If this problem persists, please check wiring and definitions in the settings.h file, and presence of the right firmware");
Serial.println("Performing firmware flash in about 10 seconds");
vTaskDelay(10000 / portTICK_PERIOD_MS);
performDeviceFlash();
} else {
Serial.println("I wasn't able to connect to a ZBS tag, trying to reboot the tag.");
rampTagPower(FLASHER_AP_POWER, false);
vTaskDelay(2 / portTICK_PERIOD_MS);
rampTagPower(FLASHER_AP_POWER, true);
wsErr("The AP tag crashed. Restarting tag, regenerating all pending info.");
refreshAllPending();
}
} else {
Ping();
}