Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Nov 3, 2020
1 parent b7d4711 commit 9bf2cc3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/eez/modules/psu/ethernet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,12 @@ scpi_t g_scpiContext;

////////////////////////////////////////////////////////////////////////////////

void init() {
void initScpi() {
scpi::init(g_scpiContext, g_scpiPsuContext, &g_scpiInterface, g_scpiInputBuffer, SCPI_PARSER_INPUT_BUFFER_LENGTH, g_errorQueueData, SCPI_PARSER_ERROR_QUEUE_SIZE + 1);
}

void init() {
initScpi();

if (!persist_conf::isEthernetEnabled()) {
g_testResult = TEST_SKIPPED;
Expand Down Expand Up @@ -150,7 +154,7 @@ void onQueueMessage(uint32_t type, uint32_t param) {
//DebugTrace("Listening on port %d", (int)persist_conf::devConf.ethernetScpiPort);
} else if (type == ETHERNET_CLIENT_CONNECTED) {
g_isConnected = true;
scpi::emptyBuffer(g_scpiContext);
initScpi();
} else if (type == ETHERNET_CLIENT_DISCONNECTED) {
g_isConnected = false;
} else if (type == ETHERNET_INPUT_AVAILABLE) {
Expand Down
1 change: 0 additions & 1 deletion src/eez/modules/psu/scpi/psu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ void init(scpi_t &scpi_context, scpi_psu_t &scpi_psu_context, scpi_interface_t *
getSerialNumber(), MCU_FIRMWARE, input_buffer, input_buffer_length,
error_queue_data, error_queue_size);


if (CH_NUM > 0) {
auto &channel = Channel::get(0);
scpi_psu_context.selectedChannels.numChannels = 1;
Expand Down
9 changes: 5 additions & 4 deletions src/eez/modules/psu/serial_psu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ static bool g_isConnected;
////////////////////////////////////////////////////////////////////////////////

void init() {
initScpi();

initScpi();
#ifdef EEZ_PLATFORM_SIMULATOR
if (usb::isVirtualComPortActive()) {
Serial.print("EEZ BB3 software simulator ver. ");
Expand All @@ -118,9 +118,10 @@ void init() {

void onQueueMessage(uint32_t type, uint32_t param) {
if (type == SERIAL_LINE_STATE_CHANGED) {
bool wasConnected = isConnected();
g_isConnected = param ? true : false;
if (isConnected()) {
scpi::emptyBuffer(g_scpiContext);
if (isConnected() && !wasConnected) {
initScpi();
}
} else if (type == SERIAL_INPUT_AVAILABLE) {
uint8_t *buffer;
Expand Down

0 comments on commit 9bf2cc3

Please sign in to comment.