Skip to content

Commit

Permalink
survive mode fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Dec 27, 2020
1 parent f9b440d commit e49fcd5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 15 deletions.
14 changes: 0 additions & 14 deletions src/eez/modules/dib-mio168/dib-mio168.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@

#include <scpi/scpi.h>

volatile uint32_t g_debugVarRequestStructSize;
volatile uint32_t g_debugVarState;
volatile uint32_t g_debugVarNumCrcErrors;
volatile uint32_t g_debugVarNumTransferErrors;

using namespace eez::psu;
using namespace eez::psu::gui;
using namespace eez::gui;
Expand Down Expand Up @@ -1157,7 +1152,6 @@ struct Mio168Module : public Module {

Mio168Module() {
assert(sizeof(Request) == sizeof(Response));
g_debugVarRequestStructSize = sizeof(Request);

moduleType = MODULE_TYPE_DIB_MIO168;
moduleName = "MIO168";
Expand Down Expand Up @@ -1532,9 +1526,7 @@ struct Mio168Module : public Module {
void stateTransition(Event event) {
if (event == EVENT_DMA_TRANSFER_COMPLETED) {
numCrcErrors = 0;
g_debugVarNumCrcErrors = 0;
numTransferErrors = 0;
g_debugVarNumTransferErrors = 0;
}

if (state == STATE_WAIT_SLAVE_READY_BEFORE_REQUEST) {
Expand Down Expand Up @@ -1586,7 +1578,6 @@ struct Mio168Module : public Module {
void reportDmaTransferFailed(int status) {
if (status == bp3c::comm::TRANSFER_STATUS_CRC_ERROR) {
numCrcErrors++;
g_debugVarNumCrcErrors = numCrcErrors;
if (numCrcErrors >= 5) {
event_queue::pushEvent(event_queue::EVENT_ERROR_SLOT1_CRC_CHECK_ERROR + slotIndex);
synchronized = false;
Expand All @@ -1597,7 +1588,6 @@ struct Mio168Module : public Module {
//}
} else {
numTransferErrors++;
g_debugVarNumTransferErrors = numTransferErrors;
if (numTransferErrors >= 5) {
event_queue::pushEvent(event_queue::EVENT_ERROR_SLOT1_SYNC_ERROR + slotIndex);
synchronized = false;
Expand Down Expand Up @@ -2968,8 +2958,6 @@ struct Mio168Module : public Module {

// These are executed from the low priority thread which is solely in charge of disk operations.
void executeDiskDriveOperation() {
g_debugVarState = 1;

for (int nretry = 0; nretry < 10; nretry++) {
diskOperationStatus = Mio168Module::DISK_OPERATION_NOT_FINISHED;

Expand All @@ -2985,8 +2973,6 @@ struct Mio168Module : public Module {
}

diskOperationStatus = Mio168Module::DISK_OPERATION_IDLE;

g_debugVarState = 2;
}

int diskDriveInitialize() override {
Expand Down
4 changes: 4 additions & 0 deletions src/eez/modules/psu/profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,17 @@ void init() {
}

void tick() {
#if !CONF_SURVIVE_MODE
auto tick = millis();
if (tick - g_lastAutoSaveTime > CONF_AUTO_SAVE_TIMEOUT_MS) {
g_lastAutoSaveTime = tick;
#endif
if (isTickSaveAllowed() && isAutoSaveAllowed() && isProfile0Dirty() && sd_card::isMounted(nullptr, nullptr)) {
saveStateToProfile0(true);
}
#if !CONF_SURVIVE_MODE
}
#endif
}

void onAfterSdCardMounted() {
Expand Down
2 changes: 1 addition & 1 deletion src/eez/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void watchdogReset(int fromTask) {
namespace eez {

uint32_t millis() {
return osKernelSysTick();
return HAL_GetTick();
}

void delay(uint32_t millis) {
Expand Down

0 comments on commit e49fcd5

Please sign in to comment.