Skip to content

Commit

Permalink
dlog COMMent -> REMark
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Mar 30, 2020
1 parent 4c40f19 commit af9aec1
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 19 deletions.
18 changes: 17 additions & 1 deletion modular-psu-firmware.eez-project
Original file line number Diff line number Diff line change
Expand Up @@ -534215,7 +534215,7 @@
"response": {}
},
{
"name": "SENSe:DLOG:TRACe:COMMent",
"name": "SENSe:DLOG:TRACe:REMark",
"parameters": [
{
"name": "comment",
Expand All @@ -534227,6 +534227,22 @@
}
],
"response": {}
},
{
"name": "SENSe:DLOG:TRACe:REMark?",
"parameters": [
{
"name": "comment",
"type": [
{
"type": "quoted-string"
}
]
}
],
"response": {
"type": "quoted-string"
}
}
]
},
Expand Down
4 changes: 2 additions & 2 deletions scripts/Curve Tracer/Curve Tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def start_BJT(cgnd):
scpi("CURR " + str(Ic_max))
scpi("SENS:CURR:RANG DEFault")

scpi('SENS:DLOG:TRAC:COMMent "Device name = ' + deviceName + '; Uce,max = ' + str(Uce_max) + '; Ic,max = ' + str(Ic_max) + '"')
scpi('SENS:DLOG:TRAC:REM "Device name = ' + deviceName + '; Uce,max = ' + str(Uce_max) + '; Ic,max = ' + str(Ic_max) + '"')

scpi("SENS:DLOG:TRAC:X:UNIT VOLT")
scpi("SENS:DLOG:TRAC:X:RANG:MIN " + str(Uce_min))
Expand Down Expand Up @@ -217,7 +217,7 @@ def start_MOSFET(cgnd):
scpi("VOLT 0")
scpi("CURR " + str(Id_max))

scpi('SENS:DLOG:TRAC:COMMent "Device name = ' + deviceName + '; Uds,max = ' + str(Uds_max) + '; Id,max = ' + str(Id_max) + '"')
scpi('SENS:DLOG:TRAC:REM "Device name = ' + deviceName + '; Uds,max = ' + str(Uds_max) + '; Id,max = ' + str(Id_max) + '"')

scpi("SENS:DLOG:TRAC:X:UNIT VOLT")
scpi("SENS:DLOG:TRAC:X:RANG:MIN " + str(Uds_logMin))
Expand Down
2 changes: 1 addition & 1 deletion scripts/Diode Tester/Diode Tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def start():
scpi("VOLT 0")
scpi("CURR " + str(I_SET))

scpi('SENS:DLOG:TRAC:COMMent "Diode name = ' + diode_name + '; U step = ' + str(U_step) + '"')
scpi('SENS:DLOG:TRAC:REM "Diode name = ' + diode_name + '; U step = ' + str(U_step) + '"')

scpi("SENS:DLOG:TRAC:X:UNIT VOLT")
scpi("SENS:DLOG:TRAC:X:STEP " + str(U_step))
Expand Down
2 changes: 1 addition & 1 deletion scripts/transfer-curve (NPN).py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def start(deviceName):
scpi("CURR " + str(Ic_max))
scpi("SENS:CURR:RANG DEFault")

scpi('SENS:DLOG:TRAC:COMMent "NPN Transfer curve for ' + deviceName + '"')
scpi('SENS:DLOG:TRAC:REM "NPN Transfer curve for ' + deviceName + '"')

scpi("SENS:DLOG:TRAC:X:UNIT VOLT")
scpi("SENS:DLOG:TRAC:X:RANG:MIN " + str(Ube_min + Ube_step))
Expand Down
23 changes: 19 additions & 4 deletions src/eez/modules/psu/dlog_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ void scaleToFit(Recording &recording) {
}
}

void openFile(const char *filePath) {
bool openFile(const char *filePath, int *err) {
if (osThreadGetId() != g_scpiTaskHandle) {
g_state = STATE_LOADING;
g_loadingStartTickCount = millis();
Expand All @@ -572,11 +572,13 @@ void openFile(const char *filePath) {
memset(&g_recording, 0, sizeof(Recording));

osMessagePut(g_scpiMessageQueueId, SCPI_QUEUE_MESSAGE(SCPI_QUEUE_MESSAGE_TARGET_NONE, SCPI_QUEUE_MESSAGE_DLOG_SHOW_FILE, 0), osWaitForever);
return;
return true;
}

g_state = STATE_LOADING;

File file;
if (file.open(g_filePath, FILE_OPEN_EXISTING | FILE_READ)) {
if (file.open(filePath != nullptr ? filePath : g_filePath, FILE_OPEN_EXISTING | FILE_READ)) {
uint8_t * buffer = FILE_VIEW_BUFFER;
uint32_t read = file.read(buffer, DLOG_VERSION1_HEADER_SIZE);
if (read == DLOG_VERSION1_HEADER_SIZE) {
Expand Down Expand Up @@ -749,13 +751,26 @@ void openFile(const char *filePath) {
}
}
}

if (g_state != STATE_READY) {
if (err) {
// TODO
*err = SCPI_ERROR_MASS_STORAGE_ERROR;
}
}
} else {
if (err) {
*err = SCPI_ERROR_FILE_NOT_FOUND;
}
}

file.close();

if (g_state == STATE_LOADING) {
if (g_state != STATE_READY) {
g_state = STATE_ERROR;
}

return g_state != STATE_ERROR;
}

Recording &getRecording() {
Expand Down
2 changes: 1 addition & 1 deletion src/eez/modules/psu/dlog_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ extern bool g_showLegend;
extern bool g_showLabels;

// open dlog file for viewing
void openFile(const char *filePath);
bool openFile(const char *filePath, int *err = nullptr);

extern State getState();

Expand Down
25 changes: 24 additions & 1 deletion src/eez/modules/psu/scpi/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <eez/system.h>
#endif

#include <eez/modules/psu/dlog_record.h>
#include <eez/modules/psu/dlog_view.h>

#include <eez/libs/image/jpeg.h>
Expand Down Expand Up @@ -197,7 +198,29 @@ scpi_result_t scpi_cmd_displayDataQ(scpi_t *context) {

scpi_result_t scpi_cmd_displayWindowDlog(scpi_t *context) {
#if OPTION_DISPLAY
dlog_view::g_showLatest = true;
char filePath[MAX_PATH_LENGTH + 1];
bool isFilePathSpecified;
if (!getFilePath(context, filePath, false, &isFilePathSpecified)) {
return SCPI_RES_ERR;
}

if (isFilePathSpecified) {
psu::dlog_view::g_showLatest = false;
int err;
if (!psu::dlog_view::openFile(filePath, &err)) {
SCPI_ErrorPush(context, err);
return SCPI_RES_ERR;
}

} else {
dlog_view::g_showLatest = true;
if (!dlog_record::isExecuting()) {
if (dlog_record::getLatestFilePath()) {
dlog_view::openFile(dlog_record::getLatestFilePath());
}
}
}

psu::gui::pushPage(PAGE_ID_DLOG_VIEW);
return SCPI_RES_OK;
#else
Expand Down
4 changes: 2 additions & 2 deletions src/eez/modules/psu/scpi/dlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ scpi_result_t scpi_cmd_senseDlogTimeQ(scpi_t *context) {
return SCPI_RES_OK;
}

scpi_result_t scpi_cmd_senseDlogTraceComment(scpi_t *context) {
scpi_result_t scpi_cmd_senseDlogTraceRemark(scpi_t *context) {
if (!dlog_record::isIdle()) {
SCPI_ErrorPush(context, SCPI_ERROR_CANNOT_CHANGE_TRANSIENT_TRIGGER);
return SCPI_RES_ERR;
Expand All @@ -252,7 +252,7 @@ scpi_result_t scpi_cmd_senseDlogTraceComment(scpi_t *context) {
return SCPI_RES_OK;
}

scpi_result_t scpi_cmd_senseDlogTraceCommentQ(scpi_t *context) {
scpi_result_t scpi_cmd_senseDlogTraceRemarkQ(scpi_t *context) {
SCPI_ResultText(context, dlog_record::g_parameters.comment);
return SCPI_RES_OK;
}
Expand Down
10 changes: 7 additions & 3 deletions src/eez/modules/psu/scpi/params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,6 @@ uint32_t param_channels(scpi_t *context, scpi_parameter_t *parameter, scpi_bool_
}

Channel *set_channel_from_command_number(scpi_t *context) {
scpi_psu_t *psu_context = (scpi_psu_t *)context->user_context;

int32_t channelIndex;
SCPI_CommandNumbers(context, &channelIndex, 1, -1);
if (channelIndex != -1) {
Expand Down Expand Up @@ -734,7 +732,7 @@ void cleanupPath(char *filePath) {
*q = 0;
}

bool getFilePath(scpi_t *context, char *filePath, bool mandatory) {
bool getFilePath(scpi_t *context, char *filePath, bool mandatory, bool *isParameterSpecified) {
scpi_psu_t *psuContext = (scpi_psu_t *)context->user_context;

const char *filePathParam;
Expand Down Expand Up @@ -763,11 +761,17 @@ bool getFilePath(scpi_t *context, char *filePath, bool mandatory) {
strncpy(filePath + currentDirectoryLen + 1, filePathParam, filePathParamLen);
filePath[filePathLen] = 0;
}
if (isParameterSpecified) {
*isParameterSpecified = true;
}
} else {
if (SCPI_ParamErrorOccurred(context)) {
return false;
}
strcpy(filePath, psuContext->currentDirectory);
if (isParameterSpecified) {
*isParameterSpecified = false;
}
}

cleanupPath(filePath);
Expand Down
3 changes: 2 additions & 1 deletion src/eez/modules/psu/scpi/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ bool get_profile_location_param(scpi_t *context, int &location, bool all_locatio
void outputOnTime(scpi_t* context, uint32_t time);
bool checkPassword(scpi_t *context, const char *againstPassword);

bool getFilePath(scpi_t *context, char *filePath, bool mandatory);
// returns current directory if parameter is not specified
bool getFilePath(scpi_t *context, char *filePath, bool mandatory, bool *isParameterSpecified = nullptr);

}
}
Expand Down
3 changes: 2 additions & 1 deletion src/eez/scpi/commands_simulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@
SCPI_COMMAND("SENSe:DLOG:TRACe:Y:SCALe", scpi_cmd_senseDlogTraceYScale) \
SCPI_COMMAND("SENSe:DLOG:TRACe:Y:SCALe?", scpi_cmd_senseDlogTraceYScaleQ) \
SCPI_COMMAND("SENSe:DLOG:TRACe[:DATA]", scpi_cmd_senseDlogTraceData) \
SCPI_COMMAND("SENSe:DLOG:TRACe:COMMent", scpi_cmd_senseDlogTraceComment) \
SCPI_COMMAND("SENSe:DLOG:TRACe:REMark", scpi_cmd_senseDlogTraceRemark) \
SCPI_COMMAND("SENSe:DLOG:TRACe:REMark?", scpi_cmd_senseDlogTraceRemarkQ) \
SCPI_COMMAND("[SOURce#]:CURRent:LIMit[:POSitive][:IMMediate][:AMPLitude]", scpi_cmd_sourceCurrentLimitPositiveImmediateAmplitude) \
SCPI_COMMAND("[SOURce#]:CURRent:LIMit[:POSitive][:IMMediate][:AMPLitude]?", scpi_cmd_sourceCurrentLimitPositiveImmediateAmplitudeQ) \
SCPI_COMMAND("[SOURce#]:CURRent:MODE", scpi_cmd_sourceCurrentMode) \
Expand Down
3 changes: 2 additions & 1 deletion src/eez/scpi/commands_stm32.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@
SCPI_COMMAND("SENSe:DLOG:TRACe:Y:SCALe", scpi_cmd_senseDlogTraceYScale) \
SCPI_COMMAND("SENSe:DLOG:TRACe:Y:SCALe?", scpi_cmd_senseDlogTraceYScaleQ) \
SCPI_COMMAND("SENSe:DLOG:TRACe[:DATA]", scpi_cmd_senseDlogTraceData) \
SCPI_COMMAND("SENSe:DLOG:TRACe:COMMent", scpi_cmd_senseDlogTraceComment) \
SCPI_COMMAND("SENSe:DLOG:TRACe:REMark", scpi_cmd_senseDlogTraceRemark) \
SCPI_COMMAND("SENSe:DLOG:TRACe:REMark?", scpi_cmd_senseDlogTraceRemarkQ) \
SCPI_COMMAND("[SOURce#]:CURRent:LIMit[:POSitive][:IMMediate][:AMPLitude]", scpi_cmd_sourceCurrentLimitPositiveImmediateAmplitude) \
SCPI_COMMAND("[SOURce#]:CURRent:LIMit[:POSitive][:IMMediate][:AMPLitude]?", scpi_cmd_sourceCurrentLimitPositiveImmediateAmplitudeQ) \
SCPI_COMMAND("[SOURce#]:CURRent:MODE", scpi_cmd_sourceCurrentMode) \
Expand Down

0 comments on commit af9aec1

Please sign in to comment.