Skip to content

Commit

Permalink
SCPI refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mvladic committed Feb 20, 2017
1 parent 075efca commit c958c00
Show file tree
Hide file tree
Showing 39 changed files with 490 additions and 876 deletions.
2 changes: 1 addition & 1 deletion eez_psu_sketch/actions.cpp
@@ -1,6 +1,6 @@
/*
* EEZ PSU Firmware
* Copyright (C) 2016-present, Envox d.o.o.
* Copyright (C) 2017-present, Envox d.o.o.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion eez_psu_sketch/actions.h
@@ -1,6 +1,6 @@
/*
* EEZ PSU Firmware
* Copyright (C) 2016-present, Envox d.o.o.
* Copyright (C) 2017-present, Envox d.o.o.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion eez_psu_sketch/gui_document.cpp
@@ -1,6 +1,6 @@
/*
* EEZ PSU Firmware
* Copyright (C) 2015-present, Envox d.o.o.
* Copyright (C) 2017-present, Envox d.o.o.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion eez_psu_sketch/gui_document.h
@@ -1,6 +1,6 @@
/*
* EEZ PSU Firmware
* Copyright (C) 2015-present, Envox d.o.o.
* Copyright (C) 2017-present, Envox d.o.o.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
5 changes: 2 additions & 3 deletions eez_psu_sketch/scpi_appl.cpp
Expand Up @@ -18,7 +18,6 @@

#include "psu.h"
#include "scpi_psu.h"
#include "scpi_appl.h"
#include "channel_dispatcher.h"

namespace eez {
Expand All @@ -35,7 +34,7 @@ static scpi_choice_def_t current_or_voltage_choice[] = {

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

scpi_result_t scpi_appl_Apply(scpi_t *context) {
scpi_result_t scpi_cmd_apply(scpi_t *context) {
Channel *channel = param_channel(context, TRUE);
if (!channel) {
return SCPI_RES_ERR;
Expand Down Expand Up @@ -89,7 +88,7 @@ scpi_result_t scpi_appl_Apply(scpi_t *context) {
return SCPI_RES_OK;
}

scpi_result_t scpi_appl_ApplyQ(scpi_t * context) {
scpi_result_t scpi_cmd_applyQ(scpi_t * context) {
Channel *channel = param_channel(context, TRUE);
if (!channel) {
return SCPI_RES_ERR;
Expand Down
24 changes: 0 additions & 24 deletions eez_psu_sketch/scpi_appl.h

This file was deleted.

27 changes: 13 additions & 14 deletions eez_psu_sketch/scpi_cal.cpp
Expand Up @@ -18,7 +18,6 @@

#include "psu.h"
#include "scpi_psu.h"
#include "scpi_cal.h"

#include "calibration.h"
#include "channel_dispatcher.h"
Expand Down Expand Up @@ -112,7 +111,7 @@ static scpi_result_t calibration_data(scpi_t * context, calibration::Value &cali

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

scpi_result_t scpi_cal_Clear(scpi_t * context) {
scpi_result_t scpi_cmd_calibrationClear(scpi_t * context) {
if (calibration::isEnabled()) {
SCPI_ErrorPush(context, SCPI_ERROR_BAD_SEQUENCE_OF_CALIBRATION_COMMANDS);
return SCPI_RES_ERR;
Expand All @@ -133,7 +132,7 @@ scpi_result_t scpi_cal_Clear(scpi_t * context) {
return SCPI_RES_OK;
}

scpi_result_t scpi_cal_Mode(scpi_t * context) {
scpi_result_t scpi_cmd_calibrationMode(scpi_t * context) {
if (channel_dispatcher::isCoupled()) {
SCPI_ErrorPush(context, SCPI_ERROR_EXECUTE_ERROR_CHANNELS_ARE_COUPLED);
return SCPI_RES_ERR;
Expand Down Expand Up @@ -176,20 +175,20 @@ scpi_result_t scpi_cal_Mode(scpi_t * context) {
return SCPI_RES_OK;
}

scpi_result_t scpi_cal_ModeQ(scpi_t * context) {
scpi_result_t scpi_cmd_calibrationModeQ(scpi_t * context) {
SCPI_ResultBool(context, calibration::isEnabled());
return SCPI_RES_OK;
}

scpi_result_t scpi_cal_CurrentData(scpi_t * context) {
scpi_result_t scpi_cmd_calibrationCurrentData(scpi_t * context) {
return calibration_data(context, calibration::g_current);
}

scpi_result_t scpi_cal_CurrentLevel(scpi_t * context) {
scpi_result_t scpi_cmd_calibrationCurrentLevel(scpi_t * context) {
return calibration_level(context, calibration::g_current);
}

scpi_result_t scpi_cal_PasswordNew(scpi_t * context) {
scpi_result_t scpi_cmd_calibrationPasswordNew(scpi_t * context) {
if (!check_password(context)) {
return SCPI_RES_ERR;
}
Expand All @@ -215,7 +214,7 @@ scpi_result_t scpi_cal_PasswordNew(scpi_t * context) {
return SCPI_RES_OK;
}

scpi_result_t scpi_cal_Remark(scpi_t * context) {
scpi_result_t scpi_cmd_calibrationRemark(scpi_t * context) {
if (!calibration::isEnabled()) {
SCPI_ErrorPush(context, SCPI_ERROR_CALIBRATION_STATE_IS_OFF);
return SCPI_RES_ERR;
Expand All @@ -237,7 +236,7 @@ scpi_result_t scpi_cal_Remark(scpi_t * context) {
return SCPI_RES_OK;
}

scpi_result_t scpi_cal_RemarkQ(scpi_t * context) {
scpi_result_t scpi_cmd_calibrationRemarkQ(scpi_t * context) {
const char *remark;

if (calibration::isEnabled()) {
Expand All @@ -254,7 +253,7 @@ scpi_result_t scpi_cal_RemarkQ(scpi_t * context) {
return SCPI_RES_OK;
}

scpi_result_t scpi_cal_Save(scpi_t * context) {
scpi_result_t scpi_cmd_calibrationSave(scpi_t * context) {
int16_t err;
if (!calibration::canSave(err)) {
SCPI_ErrorPush(context, err);
Expand All @@ -269,7 +268,7 @@ scpi_result_t scpi_cal_Save(scpi_t * context) {
return SCPI_RES_OK;
}

scpi_result_t scpi_cal_State(scpi_t * context) {
scpi_result_t scpi_cmd_calibrationState(scpi_t * context) {
if (channel_dispatcher::isCoupled()) {
SCPI_ErrorPush(context, SCPI_ERROR_EXECUTE_ERROR_CHANNELS_ARE_COUPLED);
return SCPI_RES_ERR;
Expand Down Expand Up @@ -308,7 +307,7 @@ scpi_result_t scpi_cal_State(scpi_t * context) {
return SCPI_RES_OK;
}

scpi_result_t scpi_cal_StateQ(scpi_t * context) {
scpi_result_t scpi_cmd_calibrationStateQ(scpi_t * context) {
scpi_psu_t *psu_context = (scpi_psu_t *)context->user_context;
Channel *channel = &Channel::get(psu_context->selected_channel_index - 1);

Expand All @@ -317,11 +316,11 @@ scpi_result_t scpi_cal_StateQ(scpi_t * context) {
return SCPI_RES_OK;
}

scpi_result_t scpi_cal_VoltageData(scpi_t * context) {
scpi_result_t scpi_cmd_calibrationVoltageData(scpi_t * context) {
return calibration_data(context, calibration::g_voltage);
}

scpi_result_t scpi_cal_VoltageLevel(scpi_t * context) {
scpi_result_t scpi_cmd_calibrationVoltageLevel(scpi_t * context) {
return calibration_level(context, calibration::g_voltage);;
}

Expand Down
35 changes: 0 additions & 35 deletions eez_psu_sketch/scpi_cal.h

This file was deleted.

0 comments on commit c958c00

Please sign in to comment.