Class: Tinkerforge::BrickletThermalImaging

Inherits:
Device
  • Object
show all
Defined in:
lib/tinkerforge/bricklet_thermal_imaging.rb

Overview

80x60 pixel thermal imaging camera

Constant Summary collapse

DEVICE_IDENTIFIER =

:nodoc:

278
DEVICE_DISPLAY_NAME =

:nodoc:

'Thermal Imaging Bricklet'
CALLBACK_HIGH_CONTRAST_IMAGE_LOW_LEVEL =

See CALLBACK_HIGH_CONTRAST_IMAGE

12
CALLBACK_TEMPERATURE_IMAGE_LOW_LEVEL =

See CALLBACK_TEMPERATURE_IMAGE

13
CALLBACK_HIGH_CONTRAST_IMAGE =

This callback is triggered with every new high contrast image if the transfer image config is configured for high contrast callback (see BrickletThermalImaging#set_image_transfer_config).

The data is organized as a 8-bit value 80x60 pixel matrix linearized in a one-dimensional array. The data is arranged line by line from top left to bottom right.

Each 8-bit value represents one gray-scale image pixel that can directly be shown to a user on a display.

.. note

If reconstructing the value fails, the callback is triggered with nil for image.

-12
CALLBACK_TEMPERATURE_IMAGE =

This callback is triggered with every new temperature image if the transfer image config is configured for temperature callback (see BrickletThermalImaging#set_image_transfer_config).

The data is organized as a 16-bit value 80x60 pixel matrix linearized in a one-dimensional array. The data is arranged line by line from top left to bottom right.

Each 16-bit value represents one temperature measurement in either Kelvin/10 or Kelvin/100 (depending on the resolution set with BrickletThermalImaging#set_resolution).

.. note

If reconstructing the value fails, the callback is triggered with nil for image.

-13
FUNCTION_GET_HIGH_CONTRAST_IMAGE_LOW_LEVEL =

:nodoc:

1
FUNCTION_GET_TEMPERATURE_IMAGE_LOW_LEVEL =

:nodoc:

2
FUNCTION_GET_STATISTICS =

:nodoc:

3
FUNCTION_SET_RESOLUTION =

:nodoc:

4
FUNCTION_GET_RESOLUTION =

:nodoc:

5
FUNCTION_SET_SPOTMETER_CONFIG =

:nodoc:

6
FUNCTION_GET_SPOTMETER_CONFIG =

:nodoc:

7
FUNCTION_SET_HIGH_CONTRAST_CONFIG =

:nodoc:

8
FUNCTION_GET_HIGH_CONTRAST_CONFIG =

:nodoc:

9
FUNCTION_SET_IMAGE_TRANSFER_CONFIG =

:nodoc:

10
FUNCTION_GET_IMAGE_TRANSFER_CONFIG =

:nodoc:

11
FUNCTION_SET_FLUX_LINEAR_PARAMETERS =

:nodoc:

14
FUNCTION_GET_FLUX_LINEAR_PARAMETERS =

:nodoc:

15
FUNCTION_SET_FFC_SHUTTER_MODE =

:nodoc:

16
FUNCTION_GET_FFC_SHUTTER_MODE =

:nodoc:

17
FUNCTION_RUN_FFC_NORMALIZATION =

:nodoc:

18
FUNCTION_GET_SPITFP_ERROR_COUNT =

:nodoc:

234
FUNCTION_SET_BOOTLOADER_MODE =

:nodoc:

235
FUNCTION_GET_BOOTLOADER_MODE =

:nodoc:

236
FUNCTION_SET_WRITE_FIRMWARE_POINTER =

:nodoc:

237
FUNCTION_WRITE_FIRMWARE =

:nodoc:

238
FUNCTION_SET_STATUS_LED_CONFIG =

:nodoc:

239
FUNCTION_GET_STATUS_LED_CONFIG =

:nodoc:

240
FUNCTION_GET_CHIP_TEMPERATURE =

:nodoc:

242
FUNCTION_RESET =

:nodoc:

243
FUNCTION_WRITE_UID =

:nodoc:

248
FUNCTION_READ_UID =

:nodoc:

249
FUNCTION_GET_IDENTITY =

:nodoc:

255
RESOLUTION_0_TO_6553_KELVIN =

:nodoc:

0
RESOLUTION_0_TO_655_KELVIN =

:nodoc:

1
FFC_STATUS_NEVER_COMMANDED =

:nodoc:

0
FFC_STATUS_IMMINENT =

:nodoc:

1
FFC_STATUS_IN_PROGRESS =

:nodoc:

2
FFC_STATUS_COMPLETE =

:nodoc:

3
IMAGE_TRANSFER_MANUAL_HIGH_CONTRAST_IMAGE =

:nodoc:

0
IMAGE_TRANSFER_MANUAL_TEMPERATURE_IMAGE =

:nodoc:

1
IMAGE_TRANSFER_CALLBACK_HIGH_CONTRAST_IMAGE =

:nodoc:

2
IMAGE_TRANSFER_CALLBACK_TEMPERATURE_IMAGE =

:nodoc:

3
SHUTTER_MODE_MANUAL =

:nodoc:

0
SHUTTER_MODE_AUTO =

:nodoc:

1
SHUTTER_MODE_EXTERNAL =

:nodoc:

2
SHUTTER_LOCKOUT_INACTIVE =

:nodoc:

0
SHUTTER_LOCKOUT_HIGH =

:nodoc:

1
SHUTTER_LOCKOUT_LOW =

:nodoc:

2
BOOTLOADER_MODE_BOOTLOADER =

:nodoc:

0
BOOTLOADER_MODE_FIRMWARE =

:nodoc:

1
BOOTLOADER_MODE_BOOTLOADER_WAIT_FOR_REBOOT =

:nodoc:

2
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_REBOOT =

:nodoc:

3
BOOTLOADER_MODE_FIRMWARE_WAIT_FOR_ERASE_AND_REBOOT =

:nodoc:

4
BOOTLOADER_STATUS_OK =

:nodoc:

0
BOOTLOADER_STATUS_INVALID_MODE =

:nodoc:

1
BOOTLOADER_STATUS_NO_CHANGE =

:nodoc:

2
BOOTLOADER_STATUS_ENTRY_FUNCTION_NOT_PRESENT =

:nodoc:

3
BOOTLOADER_STATUS_DEVICE_IDENTIFIER_INCORRECT =

:nodoc:

4
BOOTLOADER_STATUS_CRC_MISMATCH =

:nodoc:

5
STATUS_LED_CONFIG_OFF =

:nodoc:

0
STATUS_LED_CONFIG_ON =

:nodoc:

1
STATUS_LED_CONFIG_SHOW_HEARTBEAT =

:nodoc:

2
STATUS_LED_CONFIG_SHOW_STATUS =

:nodoc:

3

Constants inherited from Device

Device::DEVICE_IDENTIFIER_CHECK_MATCH, Device::DEVICE_IDENTIFIER_CHECK_MISMATCH, Device::DEVICE_IDENTIFIER_CHECK_PENDING, Device::RESPONSE_EXPECTED_ALWAYS_TRUE, Device::RESPONSE_EXPECTED_FALSE, Device::RESPONSE_EXPECTED_INVALID_FUNCTION_ID, Device::RESPONSE_EXPECTED_TRUE

Instance Attribute Summary

Attributes inherited from Device

#callback_formats, #expected_response_function_id, #expected_response_sequence_number, #high_level_callbacks, #registered_callbacks, #replaced, #uid

Instance Method Summary collapse

Methods inherited from Device

#check_validity, #dequeue_response, #enqueue_response, #get_api_version, #get_response_expected, #send_request, #set_response_expected, #set_response_expected_all

Constructor Details

#initialize(uid, ipcon) ⇒ BrickletThermalImaging

Creates an object with the unique device ID uid and adds it to the IP Connection ipcon.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 117

def initialize(uid, ipcon)
  super uid, ipcon, DEVICE_IDENTIFIER, DEVICE_DISPLAY_NAME

  @api_version = [2, 0, 2]

  @response_expected[FUNCTION_GET_HIGH_CONTRAST_IMAGE_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_TEMPERATURE_IMAGE_LOW_LEVEL] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_STATISTICS] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_RESOLUTION] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_GET_RESOLUTION] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_SPOTMETER_CONFIG] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_GET_SPOTMETER_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_HIGH_CONTRAST_CONFIG] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_GET_HIGH_CONTRAST_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_IMAGE_TRANSFER_CONFIG] = RESPONSE_EXPECTED_TRUE
  @response_expected[FUNCTION_GET_IMAGE_TRANSFER_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_FLUX_LINEAR_PARAMETERS] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_GET_FLUX_LINEAR_PARAMETERS] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_FFC_SHUTTER_MODE] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_GET_FFC_SHUTTER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_RUN_FFC_NORMALIZATION] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_GET_SPITFP_ERROR_COUNT] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_BOOTLOADER_MODE] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_WRITE_FIRMWARE_POINTER] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_WRITE_FIRMWARE] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_SET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_GET_STATUS_LED_CONFIG] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_CHIP_TEMPERATURE] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_RESET] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_WRITE_UID] = RESPONSE_EXPECTED_FALSE
  @response_expected[FUNCTION_READ_UID] = RESPONSE_EXPECTED_ALWAYS_TRUE
  @response_expected[FUNCTION_GET_IDENTITY] = RESPONSE_EXPECTED_ALWAYS_TRUE

  @callback_formats[CALLBACK_HIGH_CONTRAST_IMAGE_LOW_LEVEL] = [72, 'S C62']
  @callback_formats[CALLBACK_TEMPERATURE_IMAGE_LOW_LEVEL] = [72, 'S S31']

  @high_level_callbacks[CALLBACK_HIGH_CONTRAST_IMAGE] = [['stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => 4800, 'single_chunk' => false}, nil]
  @high_level_callbacks[CALLBACK_TEMPERATURE_IMAGE] = [['stream_chunk_offset', 'stream_chunk_data'], {'fixed_length' => 4800, 'single_chunk' => false}, nil]
  @ipcon.add_device self
end

Instance Method Details

#get_bootloader_modeObject

Returns the current bootloader mode, see BrickletThermalImaging#set_bootloader_mode.



435
436
437
438
439
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 435

def get_bootloader_mode
  check_validity

  send_request FUNCTION_GET_BOOTLOADER_MODE, [], '', 9, 'C'
end

#get_chip_temperatureObject

Returns the temperature as measured inside the microcontroller. The value returned is not the ambient temperature!

The temperature is only proportional to the real temperature and it has bad accuracy. Practically it is only useful as an indicator for temperature changes.



493
494
495
496
497
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 493

def get_chip_temperature
  check_validity

  send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, 's'
end

#get_ffc_shutter_modeObject

Sets the FFC shutter mode parameters.

See FLIR document 110-0144-03 4.5.15 for more details.

.. versionadded

2.0.6$nbsp;(Plugin)



385
386
387
388
389
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 385

def get_ffc_shutter_mode
  check_validity

  send_request FUNCTION_GET_FFC_SHUTTER_MODE, [], '', 25, 'C C ? ? L L ? S S'
end

#get_flux_linear_parametersObject

Returns the flux linear parameters, as set by BrickletThermalImaging#set_flux_linear_parameters.

.. versionadded

2.0.5$nbsp;(Plugin)



363
364
365
366
367
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 363

def get_flux_linear_parameters
  check_validity

  send_request FUNCTION_GET_FLUX_LINEAR_PARAMETERS, [], '', 24, 'S S S S S S S S'
end

#get_high_contrast_configObject

Returns the high contrast config as set by BrickletThermalImaging#set_high_contrast_config.



320
321
322
323
324
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 320

def get_high_contrast_config
  check_validity

  send_request FUNCTION_GET_HIGH_CONTRAST_CONFIG, [], '', 20, 'C4 S S2 S'
end

#get_high_contrast_imageObject

Returns the current high contrast image. See ‘here <www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__ for the difference between High Contrast and Temperature Image. If you don’t know what to use the High Contrast Image is probably right for you.

The data is organized as a 8-bit value 80x60 pixel matrix linearized in a one-dimensional array. The data is arranged line by line from top left to bottom right.

Each 8-bit value represents one gray-scale image pixel that can directly be shown to a user on a display.

Before you can use this function you have to enable it with BrickletThermalImaging#set_image_transfer_config.



558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 558

def get_high_contrast_image
  image_length = 4800
  image_data = nil # assigned in block

  @stream_mutex.synchronize {
    ret = get_high_contrast_image_low_level
    image_chunk_offset = ret[0]

    if image_chunk_offset == (1 << 16) - 1 # maximum chunk offset -> stream has no data
      image_length = 0
      image_chunk_offset = 0
      image_out_of_sync = false
      image_data = []
    else
      image_out_of_sync = image_chunk_offset != 0
      image_data = ret[1]
    end

    while not image_out_of_sync and image_data.length < image_length
      ret = get_high_contrast_image_low_level
      image_chunk_offset = ret[0]
      image_out_of_sync = image_chunk_offset != image_data.length
      image_data += ret[1]
    end

    if image_out_of_sync # discard remaining stream to bring it back in-sync
      while image_chunk_offset + 62 < image_length
        ret = get_high_contrast_image_low_level
        image_chunk_offset = ret[0]
      end

      raise StreamOutOfSyncException, 'Image stream is out-of-sync'
    end
  }

  image_data[0, image_length]
end

#get_high_contrast_image_low_levelObject

Returns the current high contrast image. See ‘here <www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__ for the difference between High Contrast and Temperature Image. If you don’t know what to use the High Contrast Image is probably right for you.

The data is organized as a 8-bit value 80x60 pixel matrix linearized in a one-dimensional array. The data is arranged line by line from top left to bottom right.

Each 8-bit value represents one gray-scale image pixel that can directly be shown to a user on a display.

Before you can use this function you have to enable it with BrickletThermalImaging#set_image_transfer_config.



173
174
175
176
177
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 173

def get_high_contrast_image_low_level
  check_validity

  send_request FUNCTION_GET_HIGH_CONTRAST_IMAGE_LOW_LEVEL, [], '', 72, 'S C62'
end

#get_identityObject

Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier.

The position can be ‘a’, ‘b’, ‘c’, ‘d’, ‘e’, ‘f’, ‘g’ or ‘h’ (Bricklet Port). A Bricklet connected to an :ref:‘Isolator Bricklet <isolator_bricklet>` is always at position ’z’.

The device identifier numbers can be found :ref:‘here <device_identifier>`. |device_identifier_constant|



540
541
542
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 540

def get_identity
  send_request FUNCTION_GET_IDENTITY, [], '', 33, 'Z8 Z8 k C3 C3 S'
end

#get_image_transfer_configObject

Returns the image transfer config, as set by BrickletThermalImaging#set_image_transfer_config.



343
344
345
346
347
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 343

def get_image_transfer_config
  check_validity

  send_request FUNCTION_GET_IMAGE_TRANSFER_CONFIG, [], '', 9, 'C'
end

#get_resolutionObject

Returns the resolution as set by BrickletThermalImaging#set_resolution.



248
249
250
251
252
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 248

def get_resolution
  check_validity

  send_request FUNCTION_GET_RESOLUTION, [], '', 9, 'C'
end

#get_spitfp_error_countObject

Returns the error count for the communication between Brick and Bricklet.

The errors are divided into

  • ACK checksum errors,

  • message checksum errors,

  • framing errors and

  • overflow errors.

The errors counts are for errors that occur on the Bricklet side. All Bricks have a similar function that returns the errors on the Brick side.



413
414
415
416
417
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 413

def get_spitfp_error_count
  check_validity

  send_request FUNCTION_GET_SPITFP_ERROR_COUNT, [], '', 24, 'L L L L'
end

#get_spotmeter_configObject

Returns the spotmeter config as set by BrickletThermalImaging#set_spotmeter_config.



269
270
271
272
273
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 269

def get_spotmeter_config
  check_validity

  send_request FUNCTION_GET_SPOTMETER_CONFIG, [], '', 12, 'C4'
end

#get_statisticsObject

Returns the spotmeter statistics, various temperatures, current resolution and status bits.

The spotmeter statistics are:

  • Index 0: Mean Temperature.

  • Index 1: Maximum Temperature.

  • Index 2: Minimum Temperature.

  • Index 3: Pixel Count of spotmeter region of interest.

The temperatures are:

  • Index 0: Focal Plain Array temperature.

  • Index 1: Focal Plain Array temperature at last FFC (Flat Field Correction).

  • Index 2: Housing temperature.

  • Index 3: Housing temperature at last FFC.

The resolution is either ‘0 to 6553 Kelvin` or `0 to 655 Kelvin`. If the resolution is the former, the temperatures are in Kelvin/10, if it is the latter the temperatures are in Kelvin/100.

FFC (Flat Field Correction) Status:

  • FFC Never Commanded: Only seen on startup before first FFC.

  • FFC Imminent: This state is entered 2 seconds prior to initiating FFC.

  • FFC In Progress: Flat field correction is started (shutter moves in front of lens and back). Takes about 1 second.

  • FFC Complete: Shutter is in waiting position again, FFC done.

Temperature warning bits:

  • Index 0: Shutter lockout (if true shutter is locked out because temperature is outside -10°C to +65°C)

  • Index 1: Overtemperature shut down imminent (goes true 10 seconds before shutdown)



228
229
230
231
232
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 228

def get_statistics
  check_validity

  send_request FUNCTION_GET_STATISTICS, [], '', 27, 'S4 S4 C C ?2'
end

#get_status_led_configObject

Returns the configuration as set by BrickletThermalImaging#set_status_led_config



481
482
483
484
485
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 481

def get_status_led_config
  check_validity

  send_request FUNCTION_GET_STATUS_LED_CONFIG, [], '', 9, 'C'
end

#get_temperature_imageObject

Returns the current temperature image. See ‘here <www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__ for the difference between High Contrast and Temperature Image. If you don’t know what to use the High Contrast Image is probably right for you.

The data is organized as a 16-bit value 80x60 pixel matrix linearized in a one-dimensional array. The data is arranged line by line from top left to bottom right.

Each 16-bit value represents one temperature measurement in either Kelvin/10 or Kelvin/100 (depending on the resolution set with BrickletThermalImaging#set_resolution).

Before you can use this function you have to enable it with BrickletThermalImaging#set_image_transfer_config.



609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 609

def get_temperature_image
  image_length = 4800
  image_data = nil # assigned in block

  @stream_mutex.synchronize {
    ret = get_temperature_image_low_level
    image_chunk_offset = ret[0]

    if image_chunk_offset == (1 << 16) - 1 # maximum chunk offset -> stream has no data
      image_length = 0
      image_chunk_offset = 0
      image_out_of_sync = false
      image_data = []
    else
      image_out_of_sync = image_chunk_offset != 0
      image_data = ret[1]
    end

    while not image_out_of_sync and image_data.length < image_length
      ret = get_temperature_image_low_level
      image_chunk_offset = ret[0]
      image_out_of_sync = image_chunk_offset != image_data.length
      image_data += ret[1]
    end

    if image_out_of_sync # discard remaining stream to bring it back in-sync
      while image_chunk_offset + 31 < image_length
        ret = get_temperature_image_low_level
        image_chunk_offset = ret[0]
      end

      raise StreamOutOfSyncException, 'Image stream is out-of-sync'
    end
  }

  image_data[0, image_length]
end

#get_temperature_image_low_levelObject

Returns the current temperature image. See ‘here <www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermal_Imaging.html#high-contrast-image-vs-temperature-image>`__ for the difference between High Contrast and Temperature Image. If you don’t know what to use the High Contrast Image is probably right for you.

The data is organized as a 16-bit value 80x60 pixel matrix linearized in a one-dimensional array. The data is arranged line by line from top left to bottom right.

Each 16-bit value represents one temperature measurement in either Kelvin/10 or Kelvin/100 (depending on the resolution set with BrickletThermalImaging#set_resolution).

Before you can use this function you have to enable it with BrickletThermalImaging#set_image_transfer_config.



192
193
194
195
196
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 192

def get_temperature_image_low_level
  check_validity

  send_request FUNCTION_GET_TEMPERATURE_IMAGE_LOW_LEVEL, [], '', 72, 'S S31'
end

#read_uidObject

Returns the current UID as an integer. Encode as Base58 to get the usual string version.



524
525
526
527
528
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 524

def read_uid
  check_validity

  send_request FUNCTION_READ_UID, [], '', 12, 'L'
end

#register_callback(id, &block) ⇒ Object

Registers a callback with ID id to the block block.



648
649
650
651
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 648

def register_callback(id, &block)
  callback = block
  @registered_callbacks[id] = callback
end

#resetObject

Calling this function will reset the Bricklet. All configurations will be lost.

After a reset you have to create new device objects, calling functions on the existing ones will result in undefined behavior!



505
506
507
508
509
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 505

def reset
  check_validity

  send_request FUNCTION_RESET, [], '', 8, ''
end

#run_ffc_normalizationObject

Starts the Flat-Field Correction (FFC) normalization.

See FLIR document 110-0144-03 4.5.16 for more details.

.. versionadded

2.0.6$nbsp;(Plugin)



396
397
398
399
400
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 396

def run_ffc_normalization
  check_validity

  send_request FUNCTION_RUN_FFC_NORMALIZATION, [], '', 8, ''
end

#set_bootloader_mode(mode) ⇒ Object

Sets the bootloader mode and returns the status after the requested mode change was instigated.

You can change from bootloader mode to firmware mode and vice versa. A change from bootloader mode to firmware mode will only take place if the entry function, device identifier and CRC are present and correct.

This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.



428
429
430
431
432
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 428

def set_bootloader_mode(mode)
  check_validity

  send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
end

#set_ffc_shutter_mode(shutter_mode, temp_lockout_state, video_freeze_during_ffc, ffc_desired, elapsed_time_since_last_ffc, desired_ffc_period, explicit_cmd_to_open, desired_ffc_temp_delta, imminent_delay) ⇒ Object

Sets the FFC shutter mode parameters.

See FLIR document 110-0144-03 4.5.15 for more details.

.. versionadded

2.0.6$nbsp;(Plugin)



374
375
376
377
378
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 374

def set_ffc_shutter_mode(shutter_mode, temp_lockout_state, video_freeze_during_ffc, ffc_desired, elapsed_time_since_last_ffc, desired_ffc_period, explicit_cmd_to_open, desired_ffc_temp_delta, imminent_delay)
  check_validity

  send_request FUNCTION_SET_FFC_SHUTTER_MODE, [shutter_mode, temp_lockout_state, video_freeze_during_ffc, ffc_desired, elapsed_time_since_last_ffc, desired_ffc_period, explicit_cmd_to_open, desired_ffc_temp_delta, imminent_delay], 'C C ? ? L L ? S S', 8, ''
end

#set_flux_linear_parameters(scene_emissivity, temperature_background, tau_window, temperatur_window, tau_atmosphere, temperature_atmosphere, reflection_window, temperature_reflection) ⇒ Object

Sets the flux linear parameters that can be used for radiometry calibration.

See FLIR document 102-PS245-100-01 for more details.

.. versionadded

2.0.5$nbsp;(Plugin)



354
355
356
357
358
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 354

def set_flux_linear_parameters(scene_emissivity, temperature_background, tau_window, temperatur_window, tau_atmosphere, temperature_atmosphere, reflection_window, temperature_reflection)
  check_validity

  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, ''
end

#set_high_contrast_config(region_of_interest, dampening_factor, clip_limit, empty_counts) ⇒ Object

Sets the high contrast region of interest, dampening factor, clip limit and empty counts. This config is only used in high contrast mode (see BrickletThermalImaging#set_image_transfer_config).

The high contrast region of interest consists of four values:

  • Index 0: Column start (has to be smaller or equal then Column end).

  • Index 1: Row start (has to be smaller then Row end).

  • Index 2: Column end (has to be smaller then 80).

  • Index 3: Row end (has to be smaller then 60).

The algorithm to generate the high contrast image is applied to this region.

Dampening Factor: This parameter is the amount of temporal dampening applied to the HEQ

(history equalization) transformation function. An IIR filter of the form

(N / 256) * previous + ((256 - N) / 256) * current

is applied, and the HEQ dampening factor represents the value N in the equation, i.e., a value that applies to the amount of influence the previous HEQ transformation function has on the current function. The lower the value of N the higher the influence of the current video frame whereas the higher the value of N the more influence the previous damped transfer function has.

Clip Limit Index 0 (AGC HEQ Clip Limit High): This parameter defines the maximum number of pixels allowed to accumulate in any given histogram bin. Any additional pixels in a given bin are clipped. The effect of this parameter is to limit the influence of highly-populated bins on the resulting HEQ transformation function.

Clip Limit Index 1 (AGC HEQ Clip Limit Low): This parameter defines an artificial population that is added to every non-empty histogram bin. In other words, if the Clip Limit Low is set to L, a bin with an actual population of X will have an effective population of L + X. Any empty bin that is nearby a populated bin will be given an artificial population of L. The effect of higher values is to provide a more linear transfer function; lower values provide a more non-linear (equalized) transfer function.

Empty Counts: This parameter specifies the maximum number of pixels in a bin that will be interpreted as an empty bin. Histogram bins with this number of pixels or less will be processed as an empty bin.



313
314
315
316
317
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 313

def set_high_contrast_config(region_of_interest, dampening_factor, clip_limit, empty_counts)
  check_validity

  send_request FUNCTION_SET_HIGH_CONTRAST_CONFIG, [region_of_interest, dampening_factor, clip_limit, empty_counts], 'C4 S S2 S', 8, ''
end

#set_image_transfer_config(config) ⇒ Object

The necessary bandwidth of this Bricklet is too high to use getter/callback or high contrast/temperature image at the same time. You have to configure the one you want to use, the Bricklet will optimize the internal configuration accordingly.

Corresponding functions:

  • Manual High Contrast Image: BrickletThermalImaging#get_high_contrast_image.

  • Manual Temperature Image: BrickletThermalImaging#get_temperature_image.

  • Callback High Contrast Image: CALLBACK_HIGH_CONTRAST_IMAGE callback.

  • Callback Temperature Image: CALLBACK_TEMPERATURE_IMAGE callback.



336
337
338
339
340
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 336

def set_image_transfer_config(config)
  check_validity

  send_request FUNCTION_SET_IMAGE_TRANSFER_CONFIG, [config], 'C', 8, ''
end

#set_resolution(resolution) ⇒ Object

Sets the resolution. The Thermal Imaging Bricklet can either measure

  • from 0 to 6553 Kelvin (-273.15°C to +6279.85°C) with 0.1°C resolution or

  • from 0 to 655 Kelvin (-273.15°C to +381.85°C) with 0.01°C resolution.

The accuracy is specified for -10°C to 450°C in the first range and -10°C and 140°C in the second range.



241
242
243
244
245
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 241

def set_resolution(resolution)
  check_validity

  send_request FUNCTION_SET_RESOLUTION, [resolution], 'C', 8, ''
end

#set_spotmeter_config(region_of_interest) ⇒ Object

Sets the spotmeter region of interest. The 4 values are

  • Index 0: Column start (has to be smaller then Column end).

  • Index 1: Row start (has to be smaller then Row end).

  • Index 2: Column end (has to be smaller then 80).

  • Index 3: Row end (has to be smaller then 60).

The spotmeter statistics can be read out with BrickletThermalImaging#get_statistics.



262
263
264
265
266
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 262

def set_spotmeter_config(region_of_interest)
  check_validity

  send_request FUNCTION_SET_SPOTMETER_CONFIG, [region_of_interest], 'C4', 8, ''
end

#set_status_led_config(config) ⇒ Object

Sets the status LED configuration. By default the LED shows communication traffic between Brick and Bricklet, it flickers once for every 10 received data packets.

You can also turn the LED permanently on/off or show a heartbeat.

If the Bricklet is in bootloader mode, the LED is will show heartbeat by default.



474
475
476
477
478
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 474

def set_status_led_config(config)
  check_validity

  send_request FUNCTION_SET_STATUS_LED_CONFIG, [config], 'C', 8, ''
end

#set_write_firmware_pointer(pointer) ⇒ Object

Sets the firmware pointer for BrickletThermalImaging#write_firmware. The pointer has to be increased by chunks of size 64. The data is written to flash every 4 chunks (which equals to one page of size 256).

This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.



447
448
449
450
451
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 447

def set_write_firmware_pointer(pointer)
  check_validity

  send_request FUNCTION_SET_WRITE_FIRMWARE_POINTER, [pointer], 'L', 8, ''
end

#write_firmware(data) ⇒ Object

Writes 64 Bytes of firmware at the position as written by BrickletThermalImaging#set_write_firmware_pointer before. The firmware is written to flash every 4 chunks.

You can only write firmware in bootloader mode.

This function is used by Brick Viewer during flashing. It should not be necessary to call it in a normal user program.



461
462
463
464
465
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 461

def write_firmware(data)
  check_validity

  send_request FUNCTION_WRITE_FIRMWARE, [data], 'C64', 9, 'C'
end

#write_uid(uid) ⇒ Object

Writes a new UID into flash. If you want to set a new UID you have to decode the Base58 encoded UID string into an integer first.

We recommend that you use Brick Viewer to change the UID.



516
517
518
519
520
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 516

def write_uid(uid)
  check_validity

  send_request FUNCTION_WRITE_UID, [uid], 'L', 8, ''
end