Skip to content

Commit

Permalink
Fix compatibility with Lepton 2.0 parts
Browse files Browse the repository at this point in the history
Radiometric functions are not available on these Leptons, so don't
let errors telling us this preclude us from imaging.
  • Loading branch information
kekiefer committed Feb 22, 2019
1 parent f64f360 commit 8f2f3f5
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Src/lepton_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,9 @@ HAL_StatusTypeDef disable_rgb888()
LEP_RESULT result;

result = LEP_SetRadTLinearEnableState(&hport_desc, rgb888_cached_tlinear_state);
if (result != LEP_OK) {
if (result == LEP_UNDEFINED_FUNCTION_ERROR) {
DEBUG_PRINTF("LEP_SetRadTLinearEnableState() not available on this lepton\r\n");
} else if (result != LEP_OK) {
DEBUG_PRINTF("Could not restore tlinear setting %d\r\n", result);
return HAL_ERROR;
}
Expand All @@ -312,14 +314,18 @@ HAL_StatusTypeDef enable_rgb888(LEP_PCOLOR_LUT_E pcolor_lut)

// save the tlinear state to restore when we end rgb888
result = LEP_GetRadTLinearEnableState(&hport_desc, &rgb888_cached_tlinear_state);
if (result != LEP_OK) {
if (result == LEP_UNDEFINED_FUNCTION_ERROR) {
DEBUG_PRINTF("LEP_GetRadTLinearEnableState() not available on this lepton\r\n");
} else if (result != LEP_OK) {
DEBUG_PRINTF("Could not get tlinear state %d\r\n", result);
return HAL_ERROR;
}

// disable tlinear because it messes with the AGC
result = LEP_SetRadTLinearEnableState(&hport_desc, LEP_RAD_DISABLE);
if (result != LEP_OK) {
if (result == LEP_UNDEFINED_FUNCTION_ERROR) {
DEBUG_PRINTF("LEP_SetRadTLinearEnableState() not available on this lepton\r\n");
} else if (result != LEP_OK) {
DEBUG_PRINTF("Could not set tlinear state %d\r\n", result);
return HAL_ERROR;
}
Expand Down

0 comments on commit 8f2f3f5

Please sign in to comment.