Skip to content

Commit

Permalink
changes in scpi commands
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Mar 27, 2020
1 parent 9d8c8de commit a95a509
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 21 deletions.
12 changes: 10 additions & 2 deletions modular-psu-firmware.eez-project
Original file line number Diff line number Diff line change
Expand Up @@ -532459,7 +532459,7 @@
}
},
{
"name": "DISPlay[:WINdow]:SELEct?",
"name": "DISPlay[:WINdow]:SELect?",
"helpLink": "EEZ BB3 SCPI reference 5.4 - DISPlay.html#disp_text",
"parameters": [
{
Expand Down Expand Up @@ -532589,7 +532589,7 @@
"response": {}
},
{
"name": "DISPlay[:WINdow]:ERROr",
"name": "DISPlay[:WINdow]:ERRor",
"parameters": [
{
"name": "message",
Expand Down Expand Up @@ -536118,6 +536118,14 @@
"type": "numeric"
}
},
{
"name": "SYSTem:CPU:VERSion?",
"helpLink": "EEZ BB3 SCPI reference 5.16 - SYSTem.html#syst_cpu_mod",
"parameters": [],
"response": {
"type": "numeric"
}
},
{
"name": "SYSTem:DATE",
"helpLink": "EEZ BB3 SCPI reference 5.16 - SYSTem.html#syst_date",
Expand Down
2 changes: 1 addition & 1 deletion src/eez/modules/psu/gui/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3084,7 +3084,7 @@ void data_sys_info_scpi_ver(DataOperationEnum operation, Cursor cursor, Value &v

void data_sys_info_cpu(DataOperationEnum operation, Cursor cursor, Value &value) {
if (operation == DATA_OPERATION_GET) {
value = Value(getCpuModel());
value = Value(getCpuModelAndVersion());
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/eez/modules/psu/psu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ void setOperBits(int bit_mask, bool on) {

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

const char *getCpuModel() {
const char *getCpuModelAndVersion() {
#if defined(EEZ_PLATFORM_SIMULATOR)
return "Simulator, " FIRMWARE;
#elif defined(EEZ_PLATFORM_STM32)
Expand All @@ -706,6 +706,10 @@ const char *getCpuType() {
#endif
}

const char *getCpuVersion() {
return FIRMWARE;
}

bool isMaxCurrentLimited() {
return g_maxCurrentLimitCause != MAX_CURRENT_LIMIT_CAUSE_NONE;
}
Expand Down
3 changes: 2 additions & 1 deletion src/eez/modules/psu/psu.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ void tick();
void setQuesBits(int bit_mask, bool on);
void setOperBits(int bit_mask, bool on);

const char *getCpuModel();
const char *getCpuModelAndVersion();
const char *getCpuType();
const char *getCpuVersion();

bool isMaxCurrentLimited();
MaxCurrentLimitCause getMaxCurrentLimitCause();
Expand Down
26 changes: 14 additions & 12 deletions src/eez/modules/psu/scpi/diag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,22 +292,24 @@ scpi_result_t scpi_cmd_diagnosticInformationProtectionQ(scpi_t *context) {

for (int i = 0; i < temp_sensor::NUM_TEMP_SENSORS; ++i) {
temp_sensor::TempSensor &sensor = temp_sensor::sensors[i];
temperature::TempSensorTemperature &sensorTemperature = temperature::sensors[i];
if (sensor.isInstalled()) {
temperature::TempSensorTemperature &sensorTemperature = temperature::sensors[i];

sprintf(buffer, "temp_%s_tripped=%d", sensor.name, (int)sensorTemperature.isTripped());
SCPI_ResultText(context, buffer);
sprintf(buffer, "temp_%s_tripped=%d", sensor.name, (int)sensorTemperature.isTripped());
SCPI_ResultText(context, buffer);

sprintf(buffer, "temp_%s_state=%d", sensor.name, (int)sensorTemperature.prot_conf.state);
SCPI_ResultText(context, buffer);
sprintf(buffer, "temp_%s_state=%d", sensor.name, (int)sensorTemperature.prot_conf.state);
SCPI_ResultText(context, buffer);

sprintf(buffer, "temp_%s_delay=", sensor.name);
strcatDuration(buffer, sensorTemperature.prot_conf.delay);
SCPI_ResultText(context, buffer);
sprintf(buffer, "temp_%s_delay=", sensor.name);
strcatDuration(buffer, sensorTemperature.prot_conf.delay);
SCPI_ResultText(context, buffer);

sprintf(buffer, "temp_%s_level=", sensor.name);
strcatFloat(buffer, sensorTemperature.prot_conf.level);
strcat(buffer, " oC");
SCPI_ResultText(context, buffer);
sprintf(buffer, "temp_%s_level=", sensor.name);
strcatFloat(buffer, sensorTemperature.prot_conf.level);
strcat(buffer, " oC");
SCPI_ResultText(context, buffer);
}
}

return SCPI_RES_OK;
Expand Down
2 changes: 1 addition & 1 deletion src/eez/modules/psu/scpi/outp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ scpi_result_t scpi_cmd_outputTrackState(scpi_t *context) {
if (parameter.type == SCPI_TOKEN_DECIMAL_NUMERIC_PROGRAM_DATA || parameter.type == SCPI_TOKEN_PROGRAM_MNEMONIC) {
int32_t enable;
if (
parameter.type == SCPI_TOKEN_DECIMAL_NUMERIC_PROGRAM_DATA && !SCPI_ParamToInt32(context, &parameter, &enable) ||
(parameter.type == SCPI_TOKEN_DECIMAL_NUMERIC_PROGRAM_DATA && !SCPI_ParamToInt32(context, &parameter, &enable)) ||
!SCPI_ParamToChoice(context, &parameter, scpi_bool_def, &enable)
) {
SCPI_ErrorPush(context, SCPI_ERROR_ILLEGAL_PARAMETER_VALUE);
Expand Down
7 changes: 6 additions & 1 deletion src/eez/modules/psu/scpi/syst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,12 @@ scpi_result_t scpi_cmd_systemCpuInformationOntimeLastQ(scpi_t *context) {
}

scpi_result_t scpi_cmd_systemCpuModelQ(scpi_t *context) {
SCPI_ResultText(context, getCpuModel());
SCPI_ResultText(context, getCpuType());
return SCPI_RES_OK;
}

scpi_result_t scpi_cmd_systemCpuVersionQ(scpi_t *context) {
SCPI_ResultText(context, getCpuVersion());
return SCPI_RES_OK;
}

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 @@ -54,7 +54,7 @@
SCPI_COMMAND("DISPlay[:WINdow]:DIALog:ACTIon?", scpi_cmd_displayWindowDialogActionQ) \
SCPI_COMMAND("DISPlay[:WINdow]:DIALog:DATA", scpi_cmd_displayWindowDialogData) \
SCPI_COMMAND("DISPlay[:WINdow]:DIALog:CLOSe", scpi_cmd_displayWindowDialogClose) \
SCPI_COMMAND("DISPlay[:WINdow]:ERROr", scpi_cmd_displayWindowError) \
SCPI_COMMAND("DISPlay[:WINdow]:ERRor", scpi_cmd_displayWindowError) \
SCPI_COMMAND("INITiate:CONTinuous", scpi_cmd_initiateContinuous) \
SCPI_COMMAND("INITiate:CONTinuous?", scpi_cmd_initiateContinuousQ) \
SCPI_COMMAND("INITiate:DLOG", scpi_cmd_initiateDlog) \
Expand Down Expand Up @@ -288,6 +288,7 @@
SCPI_COMMAND("SYSTem:CPU:INFOrmation:ONTime:LAST?", scpi_cmd_systemCpuInformationOntimeLastQ) \
SCPI_COMMAND("SYSTem:CPU:INFOrmation:ONTime:TOTal?", scpi_cmd_systemCpuInformationOntimeTotalQ) \
SCPI_COMMAND("SYSTem:CPU:MODel?", scpi_cmd_systemCpuModelQ) \
SCPI_COMMAND("SYSTem:CPU:VERSion?", scpi_cmd_systemCpuVersionQ) \
SCPI_COMMAND("SYSTem:DATE", scpi_cmd_systemDate) \
SCPI_COMMAND("SYSTem:DATE?", scpi_cmd_systemDateQ) \
SCPI_COMMAND("SYSTem:FORMat:DATE", scpi_cmd_systemFormatDate) \
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 @@ -54,7 +54,7 @@
SCPI_COMMAND("DISPlay[:WINdow]:DIALog:ACTIon?", scpi_cmd_displayWindowDialogActionQ) \
SCPI_COMMAND("DISPlay[:WINdow]:DIALog:DATA", scpi_cmd_displayWindowDialogData) \
SCPI_COMMAND("DISPlay[:WINdow]:DIALog:CLOSe", scpi_cmd_displayWindowDialogClose) \
SCPI_COMMAND("DISPlay[:WINdow]:ERROr", scpi_cmd_displayWindowError) \
SCPI_COMMAND("DISPlay[:WINdow]:ERRor", scpi_cmd_displayWindowError) \
SCPI_COMMAND("INITiate:CONTinuous", scpi_cmd_initiateContinuous) \
SCPI_COMMAND("INITiate:CONTinuous?", scpi_cmd_initiateContinuousQ) \
SCPI_COMMAND("INITiate:DLOG", scpi_cmd_initiateDlog) \
Expand Down Expand Up @@ -288,6 +288,7 @@
SCPI_COMMAND("SYSTem:CPU:INFOrmation:ONTime:LAST?", scpi_cmd_systemCpuInformationOntimeLastQ) \
SCPI_COMMAND("SYSTem:CPU:INFOrmation:ONTime:TOTal?", scpi_cmd_systemCpuInformationOntimeTotalQ) \
SCPI_COMMAND("SYSTem:CPU:MODel?", scpi_cmd_systemCpuModelQ) \
SCPI_COMMAND("SYSTem:CPU:VERSion?", scpi_cmd_systemCpuVersionQ) \
SCPI_COMMAND("SYSTem:DATE", scpi_cmd_systemDate) \
SCPI_COMMAND("SYSTem:DATE?", scpi_cmd_systemDateQ) \
SCPI_COMMAND("SYSTem:FORMat:DATE", scpi_cmd_systemFormatDate) \
Expand Down

0 comments on commit a95a509

Please sign in to comment.