|
| 1 | +{% assign sensor=site.data.sensors[page.sensor_index] %} |
| 2 | +{% include sensor-connection.html %} |
| 3 | +{% assign footnotes='' %} |
| 4 | +{% if sensor.notes %} |
| 5 | + {% assign footnotes=footnotes | append: sensor.notes %} |
| 6 | +{% endif %} |
| 7 | + |
| 8 | +<!-- the empty comments before and after the footnotes are to prevent unwanted |
| 9 | + spaces from being added between the spans --> |
| 10 | + |
| 11 | +### General Info |
| 12 | + |
| 13 | +<table id="sensor-info"> |
| 14 | + <tr class="{% cycle 'info': 'd0', 'd1' %}"> |
| 15 | + <th><code>name</code></th> |
| 16 | + <td><code>{{ sensor.name }}</code></td> |
| 17 | + </tr> |
| 18 | + {%if sensor.vendor_website %} |
| 19 | + <tr class="{% cycle 'info': 'd0', 'd1' %}"> |
| 20 | + <th>Website</th> |
| 21 | + {% assign split_website=sensor.vendor_website | split: '/' %} |
| 22 | + <td><span markdown="1">[{{ split_website[2] }}]({{ sensor.vendor_website }})</span></td> |
| 23 | + </tr> |
| 24 | + {% endif %} |
| 25 | + <tr class="{% cycle 'info': 'd0', 'd1' %}"> |
| 26 | + <th>Connection</th> |
| 27 | + <td>{{ connection }}</td> |
| 28 | + </tr> |
| 29 | + {% if sensor.default_address %} |
| 30 | + <tr class="{% cycle 'info': 'd0', 'd1' %}"> |
| 31 | + <th>Address</th> |
| 32 | + <td> |
| 33 | + {{ sensor.default_address }}<!-- |
| 34 | + {% if sensor.default_address_footnote %} |
| 35 | + --><span markdown="1">{{ sensor.default_address_footnote }}</span><!-- |
| 36 | + {% endif %} |
| 37 | + --> |
| 38 | + </td> |
| 39 | + </tr> |
| 40 | + {% endif %} |
| 41 | + <tr class="{% cycle 'info': 'd0', 'd1' %}"> |
| 42 | + <th>sysfs class</th> |
| 43 | + <td> |
| 44 | + {%if sensor.device_class %} |
| 45 | + <span markdown="1">{{ sensor.device_class }}</span><!-- |
| 46 | + {% else %} |
| 47 | + <span markdown="1">[msensor]</span><!-- |
| 48 | + {% endif %} |
| 49 | + {%if sensor.device_class_footnote %} |
| 50 | + --><span markdown="1">{{ sensor.device_class_footnote }}</span><!-- |
| 51 | + {% endif %} |
| 52 | + --> |
| 53 | + </td> |
| 54 | + </tr> |
| 55 | + {% if sensor.vendor_id %} |
| 56 | + <tr class="{% cycle 'info': 'd0', 'd1' %}"> |
| 57 | + <th><code>vendor_id</code></th> |
| 58 | + <td>{{ sensor.vendor_id }}</td> |
| 59 | + </tr> |
| 60 | + {% endif %} |
| 61 | + {% if sensor.product_id %} |
| 62 | + <tr class="{% cycle 'info': 'd0', 'd1' %}"> |
| 63 | + <th><code>product_id</code></th> |
| 64 | + <td>{{ sensor.product_id }}</td> |
| 65 | + </tr> |
| 66 | + {% endif %} |
| 67 | + {%if sensor.device_class == null %} |
| 68 | + <tr class="{% cycle 'info': 'd0', 'd1' %}"> |
| 69 | + <th># Modes</th> |
| 70 | + <td>{{ sensor.num_modes }}</td> |
| 71 | + </tr> |
| 72 | + {% endif %} |
| 73 | +</table> |
| 74 | + |
| 75 | +{%if sensor.device_class == null %} |
| 76 | +### Modes |
| 77 | + |
| 78 | +<table id="sensor-modes"> |
| 79 | + <tr class="{% cycle 'modes': 'd0', 'd1' %}"> |
| 80 | + <th><code>mode</code></th> |
| 81 | + <th>Description</th> |
| 82 | + <th><code>units</code></th> |
| 83 | + <th><code>dp</code><span markdown="1">[^dp]</span></th> |
| 84 | + <th><code>num_values</code></th> |
| 85 | + <th>Values</th> |
| 86 | + </tr> |
| 87 | + {% for mode in sensor.ms_mode_info %} |
| 88 | + {% if mode.notes %} |
| 89 | + {% assign footnotes=footnotes | append: mode.notes %} |
| 90 | + {% endif %} |
| 91 | + <tr class="{% cycle 'modes': 'd0', 'd1' %}"> |
| 92 | + <td style="white-space:nowrap;"> |
| 93 | + <code>{{ mode.name }}</code><!-- |
| 94 | + {% if mode.name_footnote %} |
| 95 | + --><span markdown="1">{{ mode.name_footnote }}</span><!-- |
| 96 | + {% endif %} |
| 97 | + {% if sensor.num_read_only_modes %} |
| 98 | + {% assign num_read_only_modes=sensor.num_read_only_modes | plus: 0 %} |
| 99 | + {%if forloop.index > num_read_only_modes %} |
| 100 | + {% if mode.name_footnote %} |
| 101 | + --><sup>,</sup><!-- |
| 102 | + {% endif %} |
| 103 | + --><span markdown="1">[^not-read-only]</span><!-- |
| 104 | + {% endif %} |
| 105 | + {% endif %} |
| 106 | + --> |
| 107 | + </td> |
| 108 | + <td>{{ mode.description }}</td> |
| 109 | + <td> |
| 110 | + {% if mode.units %} |
| 111 | + <code>{{ mode.units }}</code> |
| 112 | + {% if mode.units_description %} |
| 113 | + ({{ mode.units_description }}) |
| 114 | + {% endif %} |
| 115 | + {% else %} |
| 116 | + <i>none</i> |
| 117 | + {% endif %} |
| 118 | + </td> |
| 119 | + <td> |
| 120 | + <code> |
| 121 | + {% if mode.decimals %} |
| 122 | + {{ mode.decimals }} |
| 123 | + {% else %} |
| 124 | + 0 |
| 125 | + {% endif %} |
| 126 | + </code> |
| 127 | + </td> |
| 128 | + <td> |
| 129 | + <code> |
| 130 | + {% assign num_modes=1 %} |
| 131 | + {% if mode.data_sets %} |
| 132 | + {% assign num_modes=mode.data_sets %} |
| 133 | + {% endif %} |
| 134 | + {{ num_modes }} |
| 135 | + </code> |
| 136 | + </td> |
| 137 | + <td> |
| 138 | + {% for i in (1..num_modes) %} |
| 139 | + {% if i > 1 %} |
| 140 | + <br /> |
| 141 | + {% endif %} |
| 142 | + {% assign value=forloop.index0 | prepend: 'value' %} |
| 143 | + {% assign value_footnote=value | append: '_footnote' %} |
| 144 | + <span style="white-space:nowrap;"> |
| 145 | + <code>{{ value }}</code>: {{ mode[value] }}<!-- |
| 146 | + {% if mode[value_footnote] %} |
| 147 | + --><span markdown="1">{{ mode[value_footnote] }}</span><!-- |
| 148 | + {% endif %} |
| 149 | + --> |
| 150 | + </span> |
| 151 | + {% endfor %} |
| 152 | + </td> |
| 153 | + </tr> |
| 154 | + {% endfor %} |
| 155 | +</table> |
| 156 | + |
| 157 | +Values in the tables that look like `this` are the names of sysfs attributes |
| 158 | +or values returned by said attributes. |
| 159 | + |
| 160 | +[^dp]: Decimal places. For example, if the range of a value is from 0 to 1000 |
| 161 | + and `dp` is `1`, then the acutal range is 0.0 to 100.0 in the units specified. |
| 162 | + |
| 163 | +[^not-read-only]: This mode is not availible when the sensor is connected to a |
| 164 | + read-only input port like the HiTechnic NXT Sensor MUX. |
| 165 | +{% endif %} |
| 166 | + |
| 167 | +{{ footnotes }} |
| 168 | + |
| 169 | +[msensor]: ../msensor-class |
0 commit comments