tinkerforge 2.1.24 → 2.1.29

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +5 -5
  2. data/lib/tinkerforge/brick_dc.rb +156 -75
  3. data/lib/tinkerforge/brick_hat.rb +69 -31
  4. data/lib/tinkerforge/brick_hat_zero.rb +55 -23
  5. data/lib/tinkerforge/brick_imu.rb +185 -78
  6. data/lib/tinkerforge/brick_imu_v2.rb +209 -106
  7. data/lib/tinkerforge/brick_master.rb +491 -183
  8. data/lib/tinkerforge/brick_red.rb +197 -74
  9. data/lib/tinkerforge/brick_servo.rb +186 -102
  10. data/lib/tinkerforge/brick_silent_stepper.rb +247 -167
  11. data/lib/tinkerforge/brick_stepper.rb +211 -99
  12. data/lib/tinkerforge/bricklet_accelerometer.rb +57 -23
  13. data/lib/tinkerforge/bricklet_accelerometer_v2.rb +104 -54
  14. data/lib/tinkerforge/bricklet_air_quality.rb +116 -59
  15. data/lib/tinkerforge/bricklet_ambient_light.rb +50 -21
  16. data/lib/tinkerforge/bricklet_ambient_light_v2.rb +44 -24
  17. data/lib/tinkerforge/bricklet_ambient_light_v3.rb +65 -27
  18. data/lib/tinkerforge/bricklet_analog_in.rb +62 -25
  19. data/lib/tinkerforge/bricklet_analog_in_v2.rb +56 -23
  20. data/lib/tinkerforge/bricklet_analog_in_v3.rb +66 -25
  21. data/lib/tinkerforge/bricklet_analog_out.rb +22 -9
  22. data/lib/tinkerforge/bricklet_analog_out_v2.rb +19 -8
  23. data/lib/tinkerforge/bricklet_analog_out_v3.rb +53 -20
  24. data/lib/tinkerforge/bricklet_barometer.rb +100 -27
  25. data/lib/tinkerforge/bricklet_barometer_v2.rb +98 -37
  26. data/lib/tinkerforge/bricklet_can.rb +83 -19
  27. data/lib/tinkerforge/bricklet_can_v2.rb +171 -38
  28. data/lib/tinkerforge/bricklet_co2.rb +33 -14
  29. data/lib/tinkerforge/bricklet_co2_v2.rb +97 -38
  30. data/lib/tinkerforge/bricklet_color.rb +68 -27
  31. data/lib/tinkerforge/bricklet_color_v2.rb +86 -33
  32. data/lib/tinkerforge/bricklet_compass.rb +77 -30
  33. data/lib/tinkerforge/bricklet_current12.rb +57 -24
  34. data/lib/tinkerforge/bricklet_current25.rb +57 -24
  35. data/lib/tinkerforge/bricklet_dc_v2.rb +521 -0
  36. data/lib/tinkerforge/bricklet_distance_ir.rb +56 -23
  37. data/lib/tinkerforge/bricklet_distance_ir_v2.rb +82 -31
  38. data/lib/tinkerforge/bricklet_distance_us.rb +39 -16
  39. data/lib/tinkerforge/bricklet_distance_us_v2.rb +66 -25
  40. data/lib/tinkerforge/bricklet_dmx.rb +87 -34
  41. data/lib/tinkerforge/bricklet_dual_button.rb +23 -10
  42. data/lib/tinkerforge/bricklet_dual_button_v2.rb +63 -24
  43. data/lib/tinkerforge/bricklet_dual_relay.rb +26 -11
  44. data/lib/tinkerforge/bricklet_dust_detector.rb +39 -16
  45. data/lib/tinkerforge/bricklet_e_paper_296x128.rb +87 -32
  46. data/lib/tinkerforge/bricklet_energy_monitor.rb +72 -27
  47. data/lib/tinkerforge/bricklet_gps.rb +63 -26
  48. data/lib/tinkerforge/bricklet_gps_v2.rb +116 -47
  49. data/lib/tinkerforge/bricklet_hall_effect.rb +42 -23
  50. data/lib/tinkerforge/bricklet_hall_effect_v2.rb +70 -27
  51. data/lib/tinkerforge/bricklet_humidity.rb +50 -21
  52. data/lib/tinkerforge/bricklet_humidity_v2.rb +82 -31
  53. data/lib/tinkerforge/bricklet_imu_v3.rb +784 -0
  54. data/lib/tinkerforge/bricklet_industrial_analog_out.rb +37 -14
  55. data/lib/tinkerforge/bricklet_industrial_analog_out_v2.rb +80 -29
  56. data/lib/tinkerforge/bricklet_industrial_counter.rb +100 -39
  57. data/lib/tinkerforge/bricklet_industrial_digital_in_4.rb +44 -17
  58. data/lib/tinkerforge/bricklet_industrial_digital_in_4_v2.rb +76 -29
  59. data/lib/tinkerforge/bricklet_industrial_digital_out_4.rb +35 -14
  60. data/lib/tinkerforge/bricklet_industrial_digital_out_4_v2.rb +72 -27
  61. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma.rb +39 -16
  62. data/lib/tinkerforge/bricklet_industrial_dual_0_20ma_v2.rb +79 -30
  63. data/lib/tinkerforge/bricklet_industrial_dual_ac_relay.rb +325 -0
  64. data/lib/tinkerforge/bricklet_industrial_dual_analog_in.rb +48 -19
  65. data/lib/tinkerforge/bricklet_industrial_dual_analog_in_v2.rb +137 -31
  66. data/lib/tinkerforge/bricklet_industrial_dual_relay.rb +60 -23
  67. data/lib/tinkerforge/bricklet_industrial_ptc.rb +475 -0
  68. data/lib/tinkerforge/bricklet_industrial_quad_relay.rb +35 -14
  69. data/lib/tinkerforge/bricklet_industrial_quad_relay_v2.rb +66 -25
  70. data/lib/tinkerforge/bricklet_io16.rb +54 -21
  71. data/lib/tinkerforge/bricklet_io16_v2.rb +89 -34
  72. data/lib/tinkerforge/bricklet_io4.rb +54 -23
  73. data/lib/tinkerforge/bricklet_io4_v2.rb +95 -36
  74. data/lib/tinkerforge/bricklet_isolator.rb +72 -29
  75. data/lib/tinkerforge/bricklet_joystick.rb +58 -25
  76. data/lib/tinkerforge/bricklet_joystick_v2.rb +67 -26
  77. data/lib/tinkerforge/bricklet_laser_range_finder.rb +81 -32
  78. data/lib/tinkerforge/bricklet_laser_range_finder_v2.rb +95 -36
  79. data/lib/tinkerforge/bricklet_lcd_128x64.rb +191 -70
  80. data/lib/tinkerforge/bricklet_lcd_16x2.rb +44 -18
  81. data/lib/tinkerforge/bricklet_lcd_20x4.rb +57 -23
  82. data/lib/tinkerforge/bricklet_led_strip.rb +59 -22
  83. data/lib/tinkerforge/bricklet_led_strip_v2.rb +90 -46
  84. data/lib/tinkerforge/bricklet_line.rb +33 -14
  85. data/lib/tinkerforge/bricklet_linear_poti.rb +50 -21
  86. data/lib/tinkerforge/bricklet_linear_poti_v2.rb +54 -21
  87. data/lib/tinkerforge/bricklet_load_cell.rb +60 -23
  88. data/lib/tinkerforge/bricklet_load_cell_v2.rb +79 -30
  89. data/lib/tinkerforge/bricklet_moisture.rb +39 -16
  90. data/lib/tinkerforge/bricklet_motion_detector.rb +21 -10
  91. data/lib/tinkerforge/bricklet_motion_detector_v2.rb +61 -27
  92. data/lib/tinkerforge/bricklet_motorized_linear_poti.rb +70 -27
  93. data/lib/tinkerforge/bricklet_multi_touch.rb +30 -13
  94. data/lib/tinkerforge/bricklet_multi_touch_v2.rb +75 -28
  95. data/lib/tinkerforge/bricklet_nfc.rb +126 -62
  96. data/lib/tinkerforge/bricklet_nfc_rfid.rb +32 -13
  97. data/lib/tinkerforge/bricklet_oled_128x64.rb +28 -11
  98. data/lib/tinkerforge/bricklet_oled_128x64_v2.rb +65 -24
  99. data/lib/tinkerforge/bricklet_oled_64x48.rb +28 -11
  100. data/lib/tinkerforge/bricklet_one_wire.rb +65 -24
  101. data/lib/tinkerforge/bricklet_outdoor_weather.rb +71 -28
  102. data/lib/tinkerforge/bricklet_particulate_matter.rb +74 -30
  103. data/lib/tinkerforge/bricklet_performance_dc.rb +682 -0
  104. data/lib/tinkerforge/bricklet_piezo_buzzer.rb +18 -9
  105. data/lib/tinkerforge/bricklet_piezo_speaker.rb +21 -10
  106. data/lib/tinkerforge/bricklet_piezo_speaker_v2.rb +79 -42
  107. data/lib/tinkerforge/bricklet_ptc.rb +73 -42
  108. data/lib/tinkerforge/bricklet_ptc_v2.rb +94 -48
  109. data/lib/tinkerforge/bricklet_real_time_clock.rb +44 -33
  110. data/lib/tinkerforge/bricklet_real_time_clock_v2.rb +77 -44
  111. data/lib/tinkerforge/bricklet_remote_switch.rb +38 -29
  112. data/lib/tinkerforge/bricklet_remote_switch_v2.rb +86 -49
  113. data/lib/tinkerforge/bricklet_rgb_led.rb +17 -8
  114. data/lib/tinkerforge/bricklet_rgb_led_button.rb +61 -30
  115. data/lib/tinkerforge/bricklet_rgb_led_matrix.rb +78 -33
  116. data/lib/tinkerforge/bricklet_rgb_led_v2.rb +51 -20
  117. data/lib/tinkerforge/bricklet_rotary_encoder.rb +38 -19
  118. data/lib/tinkerforge/bricklet_rotary_encoder_v2.rb +59 -24
  119. data/lib/tinkerforge/bricklet_rotary_poti.rb +52 -28
  120. data/lib/tinkerforge/bricklet_rotary_poti_v2.rb +56 -23
  121. data/lib/tinkerforge/bricklet_rs232.rb +89 -28
  122. data/lib/tinkerforge/bricklet_rs232_v2.rb +117 -44
  123. data/lib/tinkerforge/bricklet_rs485.rb +222 -95
  124. data/lib/tinkerforge/bricklet_segment_display_4x7.rb +24 -14
  125. data/lib/tinkerforge/bricklet_segment_display_4x7_v2.rb +74 -35
  126. data/lib/tinkerforge/bricklet_servo_v2.rb +565 -0
  127. data/lib/tinkerforge/bricklet_silent_stepper_v2.rb +1024 -0
  128. data/lib/tinkerforge/bricklet_solid_state_relay.rb +24 -13
  129. data/lib/tinkerforge/bricklet_solid_state_relay_v2.rb +58 -25
  130. data/lib/tinkerforge/bricklet_sound_intensity.rb +34 -18
  131. data/lib/tinkerforge/bricklet_sound_pressure_level.rb +71 -31
  132. data/lib/tinkerforge/bricklet_temperature.rb +39 -16
  133. data/lib/tinkerforge/bricklet_temperature_ir.rb +56 -23
  134. data/lib/tinkerforge/bricklet_temperature_ir_v2.rb +70 -27
  135. data/lib/tinkerforge/bricklet_temperature_v2.rb +60 -25
  136. data/lib/tinkerforge/bricklet_thermal_imaging.rb +104 -44
  137. data/lib/tinkerforge/bricklet_thermocouple.rb +44 -24
  138. data/lib/tinkerforge/bricklet_thermocouple_v2.rb +64 -27
  139. data/lib/tinkerforge/bricklet_tilt.rb +23 -10
  140. data/lib/tinkerforge/bricklet_uv_light.rb +35 -18
  141. data/lib/tinkerforge/bricklet_uv_light_v2.rb +84 -37
  142. data/lib/tinkerforge/bricklet_voltage.rb +51 -28
  143. data/lib/tinkerforge/bricklet_voltage_current.rb +90 -73
  144. data/lib/tinkerforge/bricklet_voltage_current_v2.rb +89 -68
  145. data/lib/tinkerforge/bricklet_xmc1400_breakout.rb +79 -30
  146. data/lib/tinkerforge/device_display_names.rb +170 -0
  147. data/lib/tinkerforge/ip_connection.rb +153 -33
  148. data/lib/tinkerforge/version.rb +1 -1
  149. metadata +11 -3
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # Measures ambient temperature with 0.2°C accuracy
14
16
  class BrickletTemperatureV2 < Device
@@ -65,7 +67,7 @@ module Tinkerforge
65
67
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
66
68
  # the IP Connection <tt>ipcon</tt>.
67
69
  def initialize(uid, ipcon)
68
- super uid, ipcon
70
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
69
71
 
70
72
  @api_version = [2, 0, 0]
71
73
 
@@ -87,8 +89,9 @@ module Tinkerforge
87
89
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
88
90
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
89
91
 
90
- @callback_formats[CALLBACK_TEMPERATURE] = 's'
92
+ @callback_formats[CALLBACK_TEMPERATURE] = [10, 's']
91
93
 
94
+ @ipcon.add_device self
92
95
  end
93
96
 
94
97
  # Returns the temperature measured by the sensor.
@@ -98,7 +101,9 @@ module Tinkerforge
98
101
  # CALLBACK_TEMPERATURE callback. You can set the callback configuration
99
102
  # with BrickletTemperatureV2#set_temperature_callback_configuration.
100
103
  def get_temperature
101
- send_request FUNCTION_GET_TEMPERATURE, [], '', 2, 's'
104
+ check_validity
105
+
106
+ send_request FUNCTION_GET_TEMPERATURE, [], '', 10, 's'
102
107
  end
103
108
 
104
109
  # The period is the period with which the CALLBACK_TEMPERATURE callback is triggered
@@ -127,24 +132,30 @@ module Tinkerforge
127
132
  #
128
133
  # If the option is set to 'x' (threshold turned off) the callback is triggered with the fixed period.
129
134
  def set_temperature_callback_configuration(period, value_has_to_change, option, min, max)
130
- send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 0, ''
135
+ check_validity
136
+
137
+ send_request FUNCTION_SET_TEMPERATURE_CALLBACK_CONFIGURATION, [period, value_has_to_change, option, min, max], 'L ? k s s', 8, ''
131
138
  end
132
139
 
133
140
  # Returns the callback configuration as set by BrickletTemperatureV2#set_temperature_callback_configuration.
134
141
  def get_temperature_callback_configuration
135
- send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 10, 'L ? k s s'
142
+ check_validity
143
+
144
+ send_request FUNCTION_GET_TEMPERATURE_CALLBACK_CONFIGURATION, [], '', 18, 'L ? k s s'
136
145
  end
137
146
 
138
147
  # Enables/disables the heater. The heater can be used to test the sensor.
139
- #
140
- # By default the heater is disabled.
141
148
  def set_heater_configuration(heater_config)
142
- send_request FUNCTION_SET_HEATER_CONFIGURATION, [heater_config], 'C', 0, ''
149
+ check_validity
150
+
151
+ send_request FUNCTION_SET_HEATER_CONFIGURATION, [heater_config], 'C', 8, ''
143
152
  end
144
153
 
145
154
  # Returns the heater configuration as set by BrickletTemperatureV2#set_heater_configuration.
146
155
  def get_heater_configuration
147
- send_request FUNCTION_GET_HEATER_CONFIGURATION, [], '', 1, 'C'
156
+ check_validity
157
+
158
+ send_request FUNCTION_GET_HEATER_CONFIGURATION, [], '', 9, 'C'
148
159
  end
149
160
 
150
161
  # Returns the error count for the communication between Brick and Bricklet.
@@ -159,7 +170,9 @@ module Tinkerforge
159
170
  # The errors counts are for errors that occur on the Bricklet side. All
160
171
  # Bricks have a similar function that returns the errors on the Brick side.
161
172
  def get_spitfp_error_count
162
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
173
+ check_validity
174
+
175
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
163
176
  end
164
177
 
165
178
  # Sets the bootloader mode and returns the status after the requested
@@ -172,12 +185,16 @@ module Tinkerforge
172
185
  # This function is used by Brick Viewer during flashing. It should not be
173
186
  # necessary to call it in a normal user program.
174
187
  def set_bootloader_mode(mode)
175
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
188
+ check_validity
189
+
190
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
176
191
  end
177
192
 
178
193
  # Returns the current bootloader mode, see BrickletTemperatureV2#set_bootloader_mode.
179
194
  def get_bootloader_mode
180
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
195
+ check_validity
196
+
197
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
181
198
  end
182
199
 
183
200
  # Sets the firmware pointer for BrickletTemperatureV2#write_firmware. The pointer has
@@ -187,7 +204,9 @@ module Tinkerforge
187
204
  # This function is used by Brick Viewer during flashing. It should not be
188
205
  # necessary to call it in a normal user program.
189
206
  def set_write_firmware_pointer(pointer)
190
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
207
+ check_validity
208
+
209
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
191
210
  end
192
211
 
193
212
  # Writes 64 Bytes of firmware at the position as written by
@@ -199,7 +218,9 @@ module Tinkerforge
199
218
  # This function is used by Brick Viewer during flashing. It should not be
200
219
  # necessary to call it in a normal user program.
201
220
  def write_firmware(data)
202
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
221
+ check_validity
222
+
223
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
203
224
  end
204
225
 
205
226
  # Sets the status LED configuration. By default the LED shows
@@ -210,22 +231,28 @@ module Tinkerforge
210
231
  #
211
232
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
212
233
  def set_status_led_config(config)
213
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
234
+ check_validity
235
+
236
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
214
237
  end
215
238
 
216
239
  # Returns the configuration as set by BrickletTemperatureV2#set_status_led_config
217
240
  def get_status_led_config
218
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
241
+ check_validity
242
+
243
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
219
244
  end
220
245
 
221
- # Returns the temperature in °C as measured inside the microcontroller. The
246
+ # Returns the temperature as measured inside the microcontroller. The
222
247
  # value returned is not the ambient temperature!
223
248
  #
224
249
  # The temperature is only proportional to the real temperature and it has bad
225
250
  # accuracy. Practically it is only useful as an indicator for
226
251
  # temperature changes.
227
252
  def get_chip_temperature
228
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
253
+ check_validity
254
+
255
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
229
256
  end
230
257
 
231
258
  # Calling this function will reset the Bricklet. All configurations
@@ -235,7 +262,9 @@ module Tinkerforge
235
262
  # calling functions on the existing ones will result in
236
263
  # undefined behavior!
237
264
  def reset
238
- send_request FUNCTION_RESET, [], '', 0, ''
265
+ check_validity
266
+
267
+ send_request FUNCTION_RESET, [], '', 8, ''
239
268
  end
240
269
 
241
270
  # Writes a new UID into flash. If you want to set a new UID
@@ -244,25 +273,31 @@ module Tinkerforge
244
273
  #
245
274
  # We recommend that you use Brick Viewer to change the UID.
246
275
  def write_uid(uid)
247
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
276
+ check_validity
277
+
278
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
248
279
  end
249
280
 
250
281
  # Returns the current UID as an integer. Encode as
251
282
  # Base58 to get the usual string version.
252
283
  def read_uid
253
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
284
+ check_validity
285
+
286
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
254
287
  end
255
288
 
256
289
  # Returns the UID, the UID where the Bricklet is connected to,
257
290
  # the position, the hardware and firmware version as well as the
258
291
  # device identifier.
259
292
  #
260
- # The position can be 'a', 'b', 'c' or 'd'.
293
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
294
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
295
+ # position 'z'.
261
296
  #
262
297
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
263
298
  # |device_identifier_constant|
264
299
  def get_identity
265
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
300
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
266
301
  end
267
302
 
268
303
  # Registers a callback with ID <tt>id</tt> to the block <tt>block</tt>.
@@ -1,14 +1,16 @@
1
1
  # -*- ruby encoding: utf-8 -*-
2
2
  #############################################################
3
- # This file was automatically generated on 2019-11-25. #
3
+ # This file was automatically generated on 2021-05-06. #
4
4
  # #
5
- # Ruby Bindings Version 2.1.24 #
5
+ # Ruby Bindings Version 2.1.29 #
6
6
  # #
7
7
  # If you have a bugfix for this file and want to commit it, #
8
8
  # please fix the bug in the generator. You can find a link #
9
9
  # to the generators git repository on tinkerforge.com #
10
10
  #############################################################
11
11
 
12
+ require_relative './ip_connection'
13
+
12
14
  module Tinkerforge
13
15
  # 80x60 pixel thermal imaging camera
14
16
  class BrickletThermalImaging < Device
@@ -60,6 +62,8 @@ module Tinkerforge
60
62
  FUNCTION_GET_HIGH_CONTRAST_CONFIG = 9 # :nodoc:
61
63
  FUNCTION_SET_IMAGE_TRANSFER_CONFIG = 10 # :nodoc:
62
64
  FUNCTION_GET_IMAGE_TRANSFER_CONFIG = 11 # :nodoc:
65
+ FUNCTION_SET_FLUX_LINEAR_PARAMETERS = 14 # :nodoc:
66
+ FUNCTION_GET_FLUX_LINEAR_PARAMETERS = 15 # :nodoc:
63
67
  FUNCTION_GET_SPITFP_ERROR_COUNT = 234 # :nodoc:
64
68
  FUNCTION_SET_BOOTLOADER_MODE = 235 # :nodoc:
65
69
  FUNCTION_GET_BOOTLOADER_MODE = 236 # :nodoc:
@@ -102,9 +106,9 @@ module Tinkerforge
102
106
  # Creates an object with the unique device ID <tt>uid</tt> and adds it to
103
107
  # the IP Connection <tt>ipcon</tt>.
104
108
  def initialize(uid, ipcon)
105
- super uid, ipcon
109
+ super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME
106
110
 
107
- @api_version = [2, 0, 0]
111
+ @api_version = [2, 0, 1]
108
112
 
109
113
  @response_expected[FUNCTION_GET_HIGH_CONTRAST_IMAGE_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
110
114
  @response_expected[FUNCTION_GET_TEMPERATURE_IMAGE_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -117,6 +121,8 @@ module Tinkerforge
117
121
  @response_expected[FUNCTION_GET_HIGH_CONTRAST_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
118
122
  @response_expected[FUNCTION_SET_IMAGE_TRANSFER_CONFIG] = RESPONSE_EXPECTED_TRUE
119
123
  @response_expected[FUNCTION_GET_IMAGE_TRANSFER_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
124
+ @response_expected[FUNCTION_SET_FLUX_LINEAR_PARAMETERS] = RESPONSE_EXPECTED_FALSE
125
+ @response_expected[FUNCTION_GET_FLUX_LINEAR_PARAMETERS] = RESPONSE_EXPECTED_ALWAYS_TRUE
120
126
  @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
121
127
  @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
122
128
  @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@@ -130,11 +136,12 @@ module Tinkerforge
130
136
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
131
137
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE
132
138
 
133
- @callback_formats[CALLBACK_HIGH_CONTRAST_IMAGE_LOW_LEVEL] = 'S C62'
134
- @callback_formats[CALLBACK_TEMPERATURE_IMAGE_LOW_LEVEL] = 'S S31'
139
+ @callback_formats[CALLBACK_HIGH_CONTRAST_IMAGE_LOW_LEVEL] = [72, 'S C62']
140
+ @callback_formats[CALLBACK_TEMPERATURE_IMAGE_LOW_LEVEL] = [72, 'S S31']
135
141
 
136
142
  @high_level_callbacks[CALLBACK_HIGH_CONTRAST_IMAGE] = [['stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => 4800, 'single_chunk' => false}, nil]
137
143
  @high_level_callbacks[CALLBACK_TEMPERATURE_IMAGE] = [['stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => 4800, 'single_chunk' => false}, nil]
144
+ @ipcon.add_device self
138
145
  end
139
146
 
140
147
  # Returns the current high contrast image. See `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__
@@ -152,7 +159,9 @@ module Tinkerforge
152
159
  # Before you can use this function you have to enable it with
153
160
  # BrickletThermalImaging#set_image_transfer_config.
154
161
  def get_high_contrast_image_low_level
155
- send_request FUNCTION_GET_HIGH_CONTRAST_IMAGE_LOW_LEVEL, [], '', 64, 'S C62'
162
+ check_validity
163
+
164
+ send_request FUNCTION_GET_HIGH_CONTRAST_IMAGE_LOW_LEVEL, [], '', 72, 'S C62'
156
165
  end
157
166
 
158
167
  # Returns the current temperature image. See `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__
@@ -169,7 +178,9 @@ module Tinkerforge
169
178
  # Before you can use this function you have to enable it with
170
179
  # BrickletThermalImaging#set_image_transfer_config.
171
180
  def get_temperature_image_low_level
172
- send_request FUNCTION_GET_TEMPERATURE_IMAGE_LOW_LEVEL, [], '', 64, 'S S31'
181
+ check_validity
182
+
183
+ send_request FUNCTION_GET_TEMPERATURE_IMAGE_LOW_LEVEL, [], '', 72, 'S S31'
173
184
  end
174
185
 
175
186
  # Returns the spotmeter statistics, various temperatures, current resolution and status bits.
@@ -203,7 +214,9 @@ module Tinkerforge
203
214
  # * Index 0: Shutter lockout (if true shutter is locked out because temperature is outside -10°C to +65°C)
204
215
  # * Index 1: Overtemperature shut down imminent (goes true 10 seconds before shutdown)
205
216
  def get_statistics
206
- send_request FUNCTION_GET_STATISTICS, [], '', 20, 'S4 S4 C C ?2'
217
+ check_validity
218
+
219
+ send_request FUNCTION_GET_STATISTICS, [], '', 27, 'S4 S4 C C ?2'
207
220
  end
208
221
 
209
222
  # Sets the resolution. The Thermal Imaging Bricklet can either measure
@@ -213,15 +226,17 @@ module Tinkerforge
213
226
  #
214
227
  # The accuracy is specified for -10°C to 450°C in the
215
228
  # first range and -10°C and 140°C in the second range.
216
- #
217
- # The default value is 0 to 655 Kelvin.
218
229
  def set_resolution(resolution)
219
- send_request FUNCTION_SET_RESOLUTION, [resolution], 'C', 0, ''
230
+ check_validity
231
+
232
+ send_request FUNCTION_SET_RESOLUTION, [resolution], 'C', 8, ''
220
233
  end
221
234
 
222
235
  # Returns the resolution as set by BrickletThermalImaging#set_resolution.
223
236
  def get_resolution
224
- send_request FUNCTION_GET_RESOLUTION, [], '', 1, 'C'
237
+ check_validity
238
+
239
+ send_request FUNCTION_GET_RESOLUTION, [], '', 9, 'C'
225
240
  end
226
241
 
227
242
  # Sets the spotmeter region of interest. The 4 values are
@@ -232,15 +247,17 @@ module Tinkerforge
232
247
  # * Index 3: Row end (has to be smaller then 60).
233
248
  #
234
249
  # The spotmeter statistics can be read out with BrickletThermalImaging#get_statistics.
235
- #
236
- # The default region of interest is (39, 29, 40, 30).
237
250
  def set_spotmeter_config(region_of_interest)
238
- send_request FUNCTION_SET_SPOTMETER_CONFIG, [region_of_interest], 'C4', 0, ''
251
+ check_validity
252
+
253
+ send_request FUNCTION_SET_SPOTMETER_CONFIG, [region_of_interest], 'C4', 8, ''
239
254
  end
240
255
 
241
256
  # Returns the spotmeter config as set by BrickletThermalImaging#set_spotmeter_config.
242
257
  def get_spotmeter_config
243
- send_request FUNCTION_GET_SPOTMETER_CONFIG, [], '', 4, 'C4'
258
+ check_validity
259
+
260
+ send_request FUNCTION_GET_SPOTMETER_CONFIG, [], '', 12, 'C4'
244
261
  end
245
262
 
246
263
  # Sets the high contrast region of interest, dampening factor, clip limit and empty counts.
@@ -281,20 +298,17 @@ module Tinkerforge
281
298
  # Empty Counts: This parameter specifies the maximum number of pixels in a bin that will be
282
299
  # interpreted as an empty bin. Histogram bins with this number of pixels or less will be
283
300
  # processed as an empty bin.
284
- #
285
- # The default values are
286
- #
287
- # * Region Of Interest = (0, 0, 79, 59),
288
- # * Dampening Factor = 64,
289
- # * Clip Limit = (4800, 512) and
290
- # * Empty Counts = 2.
291
301
  def set_high_contrast_config(region_of_interest, dampening_factor, clip_limit, empty_counts)
292
- send_request FUNCTION_SET_HIGH_CONTRAST_CONFIG, [region_of_interest, dampening_factor, clip_limit, empty_counts], 'C4 S S2 S', 0, ''
302
+ check_validity
303
+
304
+ send_request FUNCTION_SET_HIGH_CONTRAST_CONFIG, [region_of_interest, dampening_factor, clip_limit, empty_counts], 'C4 S S2 S', 8, ''
293
305
  end
294
306
 
295
307
  # Returns the high contrast config as set by BrickletThermalImaging#set_high_contrast_config.
296
308
  def get_high_contrast_config
297
- send_request FUNCTION_GET_HIGH_CONTRAST_CONFIG, [], '', 12, 'C4 S S2 S'
309
+ check_validity
310
+
311
+ send_request FUNCTION_GET_HIGH_CONTRAST_CONFIG, [], '', 20, 'C4 S S2 S'
298
312
  end
299
313
 
300
314
  # The necessary bandwidth of this Bricklet is too high to use getter/callback or
@@ -307,15 +321,37 @@ module Tinkerforge
307
321
  # * Manual Temperature Image: BrickletThermalImaging#get_temperature_image.
308
322
  # * Callback High Contrast Image: CALLBACK_HIGH_CONTRAST_IMAGE callback.
309
323
  # * Callback Temperature Image: CALLBACK_TEMPERATURE_IMAGE callback.
310
- #
311
- # The default is Manual High Contrast Image (0).
312
324
  def set_image_transfer_config(config)
313
- send_request FUNCTION_SET_IMAGE_TRANSFER_CONFIG, [config], 'C', 0, ''
325
+ check_validity
326
+
327
+ send_request FUNCTION_SET_IMAGE_TRANSFER_CONFIG, [config], 'C', 8, ''
314
328
  end
315
329
 
316
330
  # Returns the image transfer config, as set by BrickletThermalImaging#set_image_transfer_config.
317
331
  def get_image_transfer_config
318
- send_request FUNCTION_GET_IMAGE_TRANSFER_CONFIG, [], '', 1, 'C'
332
+ check_validity
333
+
334
+ send_request FUNCTION_GET_IMAGE_TRANSFER_CONFIG, [], '', 9, 'C'
335
+ end
336
+
337
+ # Sets the flux linear parameters that can be used for radiometry calibration.
338
+ #
339
+ # See FLIR document 102-PS245-100-01 for more details.
340
+ #
341
+ # .. versionadded:: 2.0.5$nbsp;(Plugin)
342
+ def set_flux_linear_parameters(scene_emissivity, temperature_background, tau_window, temperatur_window, tau_atmosphere, temperature_atmosphere, reflection_window, temperature_reflection)
343
+ check_validity
344
+
345
+ send_request FUNCTION_SET_FLUX_LINEAR_PARAMETERS, [scene_emissivity, temperature_background, tau_window, temperatur_window, tau_atmosphere, temperature_atmosphere, reflection_window, temperature_reflection], 'S S S S S S S S', 8, ''
346
+ end
347
+
348
+ # Returns the flux linear parameters, as set by BrickletThermalImaging#set_flux_linear_parameters.
349
+ #
350
+ # .. versionadded:: 2.0.5$nbsp;(Plugin)
351
+ def get_flux_linear_parameters
352
+ check_validity
353
+
354
+ send_request FUNCTION_GET_FLUX_LINEAR_PARAMETERS, [], '', 24, 'S S S S S S S S'
319
355
  end
320
356
 
321
357
  # Returns the error count for the communication between Brick and Bricklet.
@@ -330,7 +366,9 @@ module Tinkerforge
330
366
  # The errors counts are for errors that occur on the Bricklet side. All
331
367
  # Bricks have a similar function that returns the errors on the Brick side.
332
368
  def get_spitfp_error_count
333
- send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 16, 'L L L L'
369
+ check_validity
370
+
371
+ send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
334
372
  end
335
373
 
336
374
  # Sets the bootloader mode and returns the status after the requested
@@ -343,12 +381,16 @@ module Tinkerforge
343
381
  # This function is used by Brick Viewer during flashing. It should not be
344
382
  # necessary to call it in a normal user program.
345
383
  def set_bootloader_mode(mode)
346
- send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 1, 'C'
384
+ check_validity
385
+
386
+ send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
347
387
  end
348
388
 
349
389
  # Returns the current bootloader mode, see BrickletThermalImaging#set_bootloader_mode.
350
390
  def get_bootloader_mode
351
- send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 1, 'C'
391
+ check_validity
392
+
393
+ send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
352
394
  end
353
395
 
354
396
  # Sets the firmware pointer for BrickletThermalImaging#write_firmware. The pointer has
@@ -358,7 +400,9 @@ module Tinkerforge
358
400
  # This function is used by Brick Viewer during flashing. It should not be
359
401
  # necessary to call it in a normal user program.
360
402
  def set_write_firmware_pointer(pointer)
361
- send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 0, ''
403
+ check_validity
404
+
405
+ send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
362
406
  end
363
407
 
364
408
  # Writes 64 Bytes of firmware at the position as written by
@@ -370,7 +414,9 @@ module Tinkerforge
370
414
  # This function is used by Brick Viewer during flashing. It should not be
371
415
  # necessary to call it in a normal user program.
372
416
  def write_firmware(data)
373
- send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 1, 'C'
417
+ check_validity
418
+
419
+ send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
374
420
  end
375
421
 
376
422
  # Sets the status LED configuration. By default the LED shows
@@ -381,22 +427,28 @@ module Tinkerforge
381
427
  #
382
428
  # If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.
383
429
  def set_status_led_config(config)
384
- send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 0, ''
430
+ check_validity
431
+
432
+ send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
385
433
  end
386
434
 
387
435
  # Returns the configuration as set by BrickletThermalImaging#set_status_led_config
388
436
  def get_status_led_config
389
- send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 1, 'C'
437
+ check_validity
438
+
439
+ send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
390
440
  end
391
441
 
392
- # Returns the temperature in °C as measured inside the microcontroller. The
442
+ # Returns the temperature as measured inside the microcontroller. The
393
443
  # value returned is not the ambient temperature!
394
444
  #
395
445
  # The temperature is only proportional to the real temperature and it has bad
396
446
  # accuracy. Practically it is only useful as an indicator for
397
447
  # temperature changes.
398
448
  def get_chip_temperature
399
- send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 2, 's'
449
+ check_validity
450
+
451
+ send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
400
452
  end
401
453
 
402
454
  # Calling this function will reset the Bricklet. All configurations
@@ -406,7 +458,9 @@ module Tinkerforge
406
458
  # calling functions on the existing ones will result in
407
459
  # undefined behavior!
408
460
  def reset
409
- send_request FUNCTION_RESET, [], '', 0, ''
461
+ check_validity
462
+
463
+ send_request FUNCTION_RESET, [], '', 8, ''
410
464
  end
411
465
 
412
466
  # Writes a new UID into flash. If you want to set a new UID
@@ -415,25 +469,31 @@ module Tinkerforge
415
469
  #
416
470
  # We recommend that you use Brick Viewer to change the UID.
417
471
  def write_uid(uid)
418
- send_request FUNCTION_WRITE_UID, [uid], 'L', 0, ''
472
+ check_validity
473
+
474
+ send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
419
475
  end
420
476
 
421
477
  # Returns the current UID as an integer. Encode as
422
478
  # Base58 to get the usual string version.
423
479
  def read_uid
424
- send_request FUNCTION_READ_UID, [], '', 4, 'L'
480
+ check_validity
481
+
482
+ send_request FUNCTION_READ_UID, [], '', 12, 'L'
425
483
  end
426
484
 
427
485
  # Returns the UID, the UID where the Bricklet is connected to,
428
486
  # the position, the hardware and firmware version as well as the
429
487
  # device identifier.
430
488
  #
431
- # The position can be 'a', 'b', 'c' or 'd'.
489
+ # The position can be 'a', 'b', 'c', 'd', 'e', 'f', 'g' or 'h' (Bricklet Port).
490
+ # A Bricklet connected to an :ref:`Isolator Bricklet <isolator_bricklet>` is always at
491
+ # position 'z'.
432
492
  #
433
493
  # The device identifier numbers can be found :ref:`here <device_identifier>`.
434
494
  # |device_identifier_constant|
435
495
  def get_identity
436
- send_request FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S'
496
+ send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
437
497
  end
438
498
 
439
499
  # Returns the current high contrast image. See `here <https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__