motech-lps-30x: Convert to SR_DF_ANALOG.
This commit is contained in:
parent
5ba417591c
commit
ddfe99d92f
|
@ -33,30 +33,36 @@ static void send_data(struct sr_dev_inst *sdi)
|
|||
{
|
||||
struct dev_context *devc;
|
||||
struct sr_datafeed_packet packet;
|
||||
struct sr_datafeed_analog_old analog;
|
||||
struct sr_datafeed_analog analog;
|
||||
struct sr_analog_encoding encoding;
|
||||
struct sr_analog_meaning meaning;
|
||||
struct sr_analog_spec spec;
|
||||
int i;
|
||||
float data[MAX_CHANNELS];
|
||||
|
||||
devc = sdi->priv;
|
||||
packet.type = SR_DF_ANALOG_OLD;
|
||||
packet.type = SR_DF_ANALOG;
|
||||
packet.payload = &analog;
|
||||
analog.channels = sdi->channels;
|
||||
analog.num_samples = 1;
|
||||
|
||||
analog.mq = SR_MQ_VOLTAGE;
|
||||
analog.unit = SR_UNIT_VOLT;
|
||||
analog.mqflags = SR_MQFLAG_DC;
|
||||
sr_analog_init(&analog, &encoding, &meaning, &spec, 0);
|
||||
|
||||
analog.meaning->channels = sdi->channels;
|
||||
analog.num_samples = 1;
|
||||
analog.meaning->mq = SR_MQ_VOLTAGE;
|
||||
analog.meaning->unit = SR_UNIT_VOLT;
|
||||
analog.meaning->mqflags = SR_MQFLAG_DC;
|
||||
analog.data = data;
|
||||
|
||||
for (i = 0; i < devc->model->num_channels; i++)
|
||||
analog.data[i] = devc->channel_status[i].output_voltage_last; /* Value always 3.3 or 5 for channel 3, if present! */
|
||||
((float *)analog.data)[i] = devc->channel_status[i].output_voltage_last; /* Value always 3.3 or 5 for channel 3, if present! */
|
||||
sr_session_send(sdi, &packet);
|
||||
|
||||
analog.mq = SR_MQ_CURRENT;
|
||||
analog.unit = SR_UNIT_AMPERE;
|
||||
analog.mqflags = 0;
|
||||
analog.meaning->mq = SR_MQ_CURRENT;
|
||||
analog.meaning->unit = SR_UNIT_AMPERE;
|
||||
analog.meaning->mqflags = 0;
|
||||
analog.data = data;
|
||||
for (i = 0; i < devc->model->num_channels; i++)
|
||||
analog.data[i] = devc->channel_status[i].output_current_last; /* Value always 0 for channel 3, if present! */
|
||||
((float *)analog.data)[i] = devc->channel_status[i].output_current_last; /* Value always 0 for channel 3, if present! */
|
||||
sr_session_send(sdi, &packet);
|
||||
|
||||
sr_sw_limits_update_samples_read(&devc->limits, 1);
|
||||
|
|
Loading…
Reference in New Issue