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_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
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.



108
109
110
111
112
113
114
115
116
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
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 108

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

  @api_version = [2, 0, 1]

  @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_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.



390
391
392
393
394
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 390

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.



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

def get_chip_temperature
  check_validity

  send_request FUNCTION_GET_CHIP_TEMPERATURE, [], '', 10, '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)



351
352
353
354
355
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 351

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.



308
309
310
311
312
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 308

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.



513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 513

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.



161
162
163
164
165
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 161

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|



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

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.



331
332
333
334
335
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 331

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.



236
237
238
239
240
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 236

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.



368
369
370
371
372
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 368

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.



257
258
259
260
261
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 257

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)



216
217
218
219
220
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 216

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



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

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.



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
595
596
597
598
599
600
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 564

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.



180
181
182
183
184
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 180

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.



479
480
481
482
483
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 479

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.



603
604
605
606
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 603

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!



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

def reset
  check_validity

  send_request FUNCTION_RESET, [], '', 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.



383
384
385
386
387
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 383

def set_bootloader_mode(mode)
  check_validity

  send_request FUNCTION_SET_BOOTLOADER_MODE, [mode], 'C', 9, 'C'
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)



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

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.



301
302
303
304
305
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 301

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.



324
325
326
327
328
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 324

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.



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

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.



250
251
252
253
254
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 250

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.



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

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.



402
403
404
405
406
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 402

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.



416
417
418
419
420
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 416

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.



471
472
473
474
475
# File 'lib/tinkerforge/bricklet_thermal_imaging.rb', line 471

def write_uid(uid)
  check_validity

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