Beispiel #1
0
scpi_result_t SCPIMM_trigger_delay_auto(scpi_t* context) {
	scpi_bool_t b;

    if (!SCPI_ParamBool(context, &b, TRUE)) {
		return SCPI_RES_ERR;
	}

	SCPIMM_CONTEXT(context)->trigger_auto_delay = b;
    return SCPI_RES_OK;
}
Beispiel #2
0
scpi_result_t scpi_syst_BeeperState(scpi_t * context) {
    bool enable;
    if (!SCPI_ParamBool(context, &enable, TRUE)) {
        return SCPI_RES_ERR;
    }

    if (enable != persist_conf::isBeepEnabled()) {
        persist_conf::enableBeep(enable);
    }

    return SCPI_RES_OK;
}
Beispiel #3
0
static scpi_result_t TEST_Bool(scpi_t * context) {
    scpi_bool_t param1;
    printf( "TEST:BOOL\r\n"); // debug command name   

    // read first parameter if present
    if (!SCPI_ParamBool(context, &param1, TRUE)) {
        return SCPI_RES_ERR;
    }

    printf( "\tP1=%d\r\n", param1);

    return SCPI_RES_OK;
}
Beispiel #4
0
static scpi_result_t TEST_Bool(scpi_t * context) {
    scpi_bool_t param1;
    fprintf(stderr, "TEST:BOOL\r\n"); /* debug command name */

    /* read first parameter if present */
    if (!SCPI_ParamBool(context, &param1, TRUE)) {
        return SCPI_RES_ERR;
    }

    fprintf(stderr, "\tP1=%d\r\n", param1);

    return SCPI_RES_OK;
}
Beispiel #5
0
scpi_result_t set_state(scpi_t *context, Channel *channel, int type) {
	bool state;
	if (!SCPI_ParamBool(context, &state, TRUE)) {
		return SCPI_RES_ERR;
	}

    switch (type) {
    case I_STATE: channel->prot_conf.flags.i_state = state; break;
    case P_STATE: channel->prot_conf.flags.p_state = state; break;
    default:      channel->prot_conf.flags.u_state = state; break;
	}

    profile::save();

	return SCPI_RES_OK;
}
Beispiel #6
0
scpi_result_t scpi_syst_Power(scpi_t * context) {
    bool up;
    if (!SCPI_ParamBool(context, &up, TRUE)) {
        return SCPI_RES_ERR;
    }

    if (temperature::isSensorTripped(temp_sensor::MAIN)) {
        SCPI_ErrorPush(context, SCPI_ERROR_CANNOT_EXECUTE_BEFORE_CLEARING_PROTECTION);
        return SCPI_RES_ERR;
    }

    if (!psu::changePowerState(up)) {
        SCPI_ErrorPush(context, SCPI_ERROR_EXECUTION_ERROR);
        return SCPI_RES_ERR;
    }

    return SCPI_RES_OK;
}
Beispiel #7
0
scpi_result_t scpi_syst_TempProtectionState(scpi_t * context) {
    bool state;
    if (!SCPI_ParamBool(context, &state, TRUE)) {
        return SCPI_RES_ERR;
    }

    int32_t sensor;
    if (!SCPI_ParamChoice(context, main_temp_sensor_choice, &sensor, false)) {
        if (SCPI_ParamErrorOccurred(context)) {
            return SCPI_RES_ERR;
        }
        sensor = temp_sensor::MAIN;
    }

    temperature::prot_conf[sensor].state = state;
    profile::save();

    return SCPI_RES_OK;
}
Beispiel #8
0
static int dscpi_output_inner(scpi_t *context, int output)
{
    bool action;
    if (!SCPI_ParamBool(context, &action, true)) {
        return SCPI_RES_ERR;
    }
    printf("turning output %d %s", output + 1, action ? "on" : "off");
    if (output == 0) {
        SCPI_ResultString(context, "output1");
    }
    if (output == 1) {
        SCPI_ResultString(context, "output2");
    }
    if (action) {
        SCPI_ResultString(context, "on");
    } else {
        SCPI_ResultString(context, "off");
    }
    return SCPI_RES_OK;
}