This commit is contained in:
2025-04-29 23:23:45 +02:00
parent 7acfb06d42
commit bc8616ef5f
12 changed files with 305 additions and 104 deletions

View File

@@ -31,7 +31,7 @@
#include "esp_system.h"
#include "vospi.h"
#include <string.h>
#include <Arduino.h>
static bool lep_is_radiometric = false;
@@ -57,7 +57,7 @@ bool lepton_init()
// If this is successful, we assume further communication will be successful
rsp = cci_run_ping();
if (rsp != 0) {
printf("[LEP UTIL] Error: Lepton communication failed (%d)\n", rsp);
printf("[LEP UTIL] Error: Lepton communication failed (%ld)\n", rsp);
return false;
}
@@ -86,16 +86,16 @@ bool lepton_init()
// Configure Radiometry for TLinear enabled, auto-resolution
cci_set_radiometry_enable_state(CCI_RADIOMETRY_ENABLED);
rsp = cci_get_radiometry_enable_state();
printf("[LEP UTIL] Lepton Radiometry = %d\n", rsp);
printf("[LEP UTIL] Lepton Radiometry = %ld\n", rsp);
if (rsp != CCI_RADIOMETRY_ENABLED) {
// Make one more effort
delay(10);
vTaskDelay(pdMS_TO_TICKS(10));
printf("[LEP UTIL] Retry Set Lepton Radiometry\n");
cci_set_radiometry_enable_state(CCI_RADIOMETRY_ENABLED);
rsp = cci_get_radiometry_enable_state();
printf("[LEP UTIL] Lepton Radiometry = %d\n", rsp);
printf("[LEP UTIL] Lepton Radiometry = %ld\n", rsp);
if (rsp != CCI_RADIOMETRY_ENABLED) {
printf("[LEP UTIL] Error: Lepton communication failed (%d)\n", rsp);
printf("[LEP UTIL] Error: Lepton communication failed (%ld)\n", rsp);
return false;
}
}
@@ -104,17 +104,17 @@ bool lepton_init()
val = (lep_stP->agc_set_enabled) ? CCI_RADIOMETRY_TLINEAR_DISABLED : CCI_RADIOMETRY_TLINEAR_ENABLED;
cci_set_radiometry_tlinear_enable_state((cci_radiometry_tlinear_enable_state_t)val);
rsp = cci_get_radiometry_tlinear_enable_state();
printf("[LEP UTIL] Lepton Radiometry TLinear = %d\n", rsp);
printf("[LEP UTIL] Lepton Radiometry TLinear = %ld\n", rsp);
if (rsp != val) {
printf("[LEP UTIL] Error: Lepton communication failed (%d)\n", rsp);
printf("[LEP UTIL] Error: Lepton communication failed (%ld)\n", rsp);
return false;
}
cci_set_radiometry_tlinear_auto_res(CCI_RADIOMETRY_AUTO_RES_ENABLED);
rsp = cci_get_radiometry_tlinear_auto_res();
printf("[LEP UTIL] Lepton Radiometry Auto Resolution = %d\n", rsp);
printf("[LEP UTIL] Lepton Radiometry Auto Resolution = %ld\n", rsp);
if (rsp != CCI_RADIOMETRY_AUTO_RES_ENABLED) {
printf("[LEP UTIL] Error: Lepton communication failed (%d)\n", rsp);
printf("[LEP UTIL] Error: Lepton communication failed (%ld)\n", rsp);
return false;
}
}
@@ -122,9 +122,9 @@ bool lepton_init()
// Enable AGC calcs for a smooth transition between modes
cci_set_agc_calc_enable_state(CCI_AGC_ENABLED);
rsp = cci_get_agc_calc_enable_state();
printf("[LEP UTIL] Lepton AGC Calcs = %d\n", rsp);
printf("[LEP UTIL] Lepton AGC Calcs = %ld\n", rsp);
if (rsp != CCI_AGC_ENABLED) {
printf("[LEP UTIL] Error: Lepton communication failed (%d)\n", rsp);
printf("[LEP UTIL] Error: Lepton communication failed (%ld)\n", rsp);
return false;
}
@@ -132,18 +132,18 @@ bool lepton_init()
val = (lep_stP->agc_set_enabled) ? CCI_AGC_ENABLED : CCI_AGC_DISABLED;
cci_set_agc_enable_state((cci_agc_enable_state_t)val);
rsp = cci_get_agc_enable_state();
printf("[LEP UTIL] Lepton AGC = %d\n", rsp);
printf("[LEP UTIL] Lepton AGC = %ld\n", rsp);
if (rsp != val) {
printf("[LEP UTIL] Error: Lepton communication failed (%d)\n", rsp);
printf("[LEP UTIL] Error: Lepton communication failed (%ld)\n", rsp);
return false;
}
// Enable telemetry
cci_set_telemetry_enable_state(CCI_TELEMETRY_ENABLED);
rsp = cci_get_telemetry_enable_state();
printf("[LEP UTIL] Lepton Telemetry = %d\n", rsp);
printf("[LEP UTIL] Lepton Telemetry = %ld\n", rsp);
if (rsp != CCI_TELEMETRY_ENABLED) {
printf("[LEP UTIL] Error: Lepton communication failed (%d)\n", rsp);
printf("[LEP UTIL] Error: Lepton communication failed (%ld)\n", rsp);
return false;
}
vospi_include_telem(true);
@@ -161,9 +161,9 @@ bool lepton_init()
}
cci_set_gain_mode((cc_gain_mode_t)val);
rsp = cci_get_gain_mode();
printf("[LEP UTIL] Lepton Gain Mode = %d\n", rsp);
printf("[LEP UTIL] Lepton Gain Mode = %ld\n", rsp);
if (rsp != val) {
printf("[LEP UTIL] Error: Lepton communication failed (%d)\n", rsp);
printf("[LEP UTIL] Error: Lepton communication failed (%ld)\n", rsp);
return false;
}
@@ -176,9 +176,9 @@ bool lepton_init()
// Finally enable VSYNC on Lepton GPIO3
cci_set_gpio_mode(LEP_OEM_GPIO_MODE_VSYNC);
rsp = cci_get_gpio_mode();
printf("[LEP UTIL] Lepton GPIO Mode = %d\n", rsp);
printf("[LEP UTIL] Lepton GPIO Mode = %ld\n", rsp);
if (rsp != LEP_OEM_GPIO_MODE_VSYNC) {
printf("[LEP UTIL] Error: Lepton communication failed (%d)\n", rsp);
printf("[LEP UTIL] Error: Lepton communication failed (%ld)\n", rsp);
return false;
}