compass: Fix compass not working on Surface Pro 2

The _raw is not needed in the channel name for process_scan_1().
This function looks up the channel from its channel name (in this
case "in_rot_from_north_magnetic_tilt_comp").

The channel name is read from the file ending in _en from the
scanning_element folder, in build_channel_array().

Closes #38
This commit is contained in:
Reyad Attiyat
2015-07-14 02:54:04 -05:00
committed by Bastien Nocera
parent c6a2547204
commit 1e849e7406

View File

@@ -33,6 +33,7 @@ process_scan (IIOSensorData data, DrvData *or_data)
{ {
int i; int i;
int raw_heading; int raw_heading;
char* channel_name = "in_rot_from_north_magnetic_tilt_comp";
gdouble scale; gdouble scale;
gboolean present_level; gboolean present_level;
CompassReadings readings; CompassReadings readings;
@@ -51,7 +52,7 @@ process_scan (IIOSensorData data, DrvData *or_data)
return 0; return 0;
} }
process_scan_1 (data.data + or_data->buffer_data->scan_size*i, or_data->buffer_data, "in_rot_from_north_magnetic_tilt_comp_raw", &raw_heading, &scale, &present_level); process_scan_1 (data.data + or_data->buffer_data->scan_size*i, or_data->buffer_data, channel_name, &raw_heading, &scale, &present_level);
readings.heading = raw_heading * scale; readings.heading = raw_heading * scale;
g_debug ("Read from IIO: %f (%d times %f scale)", readings.heading, raw_heading, scale); g_debug ("Read from IIO: %f (%d times %f scale)", readings.heading, raw_heading, scale);