Skip to content

Commit

Permalink
gui startup speed up
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Aug 22, 2019
1 parent 80f2d41 commit 05b183f
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 65 deletions.
1 change: 0 additions & 1 deletion src/eez/apps/psu/simulator/dac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ extern uint16_t g_iSet[CH_MAX];
////////////////////////////////////////////////////////////////////////////////

DigitalAnalogConverter::DigitalAnalogConverter(Channel &channel_) : channel(channel_) {
g_testResult = TEST_SKIPPED;
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 0 additions & 2 deletions src/eez/apps/psu/simulator/ioexp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ namespace psu {
////////////////////////////////////////////////////////////////////////////////

IOExpander::IOExpander(Channel &channel_) : channel(channel_) {
g_testResult = TEST_SKIPPED;

gpio = 0B0000000100000000; // 5A
}

Expand Down
23 changes: 7 additions & 16 deletions src/eez/apps/psu/stm32/dac.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ static const uint16_t DAC_MAX = (1L << DAC_RES) - 1;
////////////////////////////////////////////////////////////////////////////////

DigitalAnalogConverter::DigitalAnalogConverter(Channel &channel_) : channel(channel_) {
g_testResult = TEST_SKIPPED;
}

////////////////////////////////////////////////////////////////////////////////
Expand All @@ -48,9 +47,9 @@ void DigitalAnalogConverter::init() {
}

bool DigitalAnalogConverter::test() {
g_testResult = TEST_OK;
g_testResult = TEST_OK;

// if (channel.ioexp.g_testResult != TEST_OK) {
// if (channel.ioexp.g_testResult != TEST_OK) {
// DebugTrace("Ch%d DAC test skipped because of IO expander", channel.index);
// g_testResult = TEST_SKIPPED;
// return true;
Expand All @@ -72,8 +71,6 @@ bool DigitalAnalogConverter::test() {
// channel.flags.outputEnabled = 0;
// channel.ioexp.changeBit(IOExpander::IO_BIT_OUT_OUTPUT_ENABLE, false);

// g_testResult = TEST_OK;

// // set U on DAC and check it on ADC
// float u_set = channel.u.max / 2;
// float i_set = channel.i.max / 2;
Expand Down Expand Up @@ -123,17 +120,11 @@ bool DigitalAnalogConverter::test() {
// channel.setVoltage(u_set_save);
// channel.setCurrent(i_set_save);

// if (g_testResult == TEST_FAILED) {
// if (channel.index == 1) {
// generateError(SCPI_ERROR_CH1_DAC_TEST_FAILED);
// }
// else if (channel.index == 2) {
// generateError(SCPI_ERROR_CH2_DAC_TEST_FAILED);
// }
// else {
// // TODO
// }
// }
// if (g_testResult == TEST_FAILED) {
// generateError(SCPI_ERROR_CH1_DAC_TEST_FAILED + channel.index - 1);
// } else {
// g_testResult == TEST_OK;
// }

// m_testing = false;

Expand Down
34 changes: 11 additions & 23 deletions src/eez/apps/psu/stm32/ioexp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ static const uint8_t REG_VALUES[] = {
////////////////////////////////////////////////////////////////////////////////

IOExpander::IOExpander(Channel &channel_) : channel(channel_) {
g_testResult = TEST_SKIPPED;
}

void IOExpander::init() {
Expand Down Expand Up @@ -157,8 +156,6 @@ void IOExpander::init() {
}

bool IOExpander::test() {
g_testResult = TEST_OK;

channel.flags.powerOk = 1;

const uint8_t N_REGS = sizeof(REG_VALUES) / 3;
Expand Down Expand Up @@ -193,31 +190,22 @@ bool IOExpander::test() {

readGpio();

if (g_testResult == TEST_OK) {
#if !CONF_SKIP_PWRGOOD_TEST
if (g_testResult == TEST_FAILED) {
generateError(SCPI_ERROR_CH1_IOEXP_TEST_FAILED + channel.index - 1);
channel.flags.powerOk = 0;
} else {
g_testResult = TEST_OK;

#if !CONF_SKIP_PWRGOOD_TEST
channel.flags.powerOk = testBit(IO_BIT_IN_PWRGOOD);
if (!channel.flags.powerOk) {
DebugTrace("Ch%d power fault", channel.index);
generateError(SCPI_ERROR_CH1_FAULT_DETECTED - (channel.index - 1));
}
#endif
} else {
channel.flags.powerOk = 0;
}

if (g_testResult == TEST_FAILED) {
if (channel.index == 1) {
generateError(SCPI_ERROR_CH1_IOEXP_TEST_FAILED);
}
else if (channel.index == 2) {
generateError(SCPI_ERROR_CH2_IOEXP_TEST_FAILED);
}
else {
// TODO
}
}

return g_testResult != TEST_FAILED;
#endif
}

return g_testResult != TEST_FAILED;
}

void IOExpander::reinit() {
Expand Down
21 changes: 11 additions & 10 deletions src/eez/gui/gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,27 +70,28 @@ osThreadId g_guiTaskHandle;
bool onSystemStateChanged() {
if (eez::g_systemState == eez::SystemState::BOOTING) {
if (eez::g_systemStatePhase == 0) {
return false;
} else if (eez::g_systemStatePhase == 1) {
decompressAssets();
mcu::display::onThemeChanged();
mcu::display::updateBrightness();
g_guiTaskHandle = osThreadCreate(osThread(g_guiTask), nullptr);
} else if (eez::g_systemStatePhase == 1) {
}
}

return true;
}


void oneIter();

bool x = false;

void mainLoop(const void *) {
if (!x) {
x = true;
decompressAssets();
mcu::display::onThemeChanged();
mcu::display::updateBrightness();
}
#ifdef __EMSCRIPTEN__
if (g_animationState.enabled) {
mcu::display::sync();
} else {
oneIter();
}
oneIter();
#else
while (1) {
osDelay(1);
Expand Down
1 change: 0 additions & 1 deletion src/eez/modules/psu/simulator/adc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ void updateValues(Channel &channel) {
}

AnalogDigitalConverter::AnalogDigitalConverter(Channel &channel_) : channel(channel_) {
g_testResult = TEST_SKIPPED;
}

void AnalogDigitalConverter::init() {
Expand Down
15 changes: 3 additions & 12 deletions src/eez/modules/psu/stm32/adc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ static const uint8_t ADC_REG3_VAL = 0B00000000;
////////////////////////////////////////////////////////////////////////////////

AnalogDigitalConverter::AnalogDigitalConverter(Channel &channel_) : channel(channel_) {
g_testResult = TEST_SKIPPED;
}

uint8_t AnalogDigitalConverter::getReg1Val() {
Expand Down Expand Up @@ -89,8 +88,6 @@ bool AnalogDigitalConverter::test() {
uint8_t reg2 = result[2];
uint8_t reg3 = result[3];

g_testResult = TEST_OK;

if (reg1 != getReg1Val()) {
DebugTrace("Ch%d ADC test failed reg1: expected=%d, got=%d", channel.index,
getReg1Val(), reg1);
Expand All @@ -110,15 +107,9 @@ bool AnalogDigitalConverter::test() {
}

if (g_testResult == TEST_FAILED) {
if (channel.index == 1) {
generateError(SCPI_ERROR_CH1_ADC_TEST_FAILED);
}
else if (channel.index == 2) {
generateError(SCPI_ERROR_CH2_ADC_TEST_FAILED);
}
else {
// TODO
}
generateError(SCPI_ERROR_CH1_ADC_TEST_FAILED + channel.index - 1);
} else {
g_testResult = TEST_OK;
}

return g_testResult != TEST_FAILED;
Expand Down

0 comments on commit 05b183f

Please sign in to comment.