diff --git a/.travis.yml b/.travis.yml index bcc5ae2..e549fae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,8 @@ script: - if [ -n "$TRAVIS_TAG" ]; then sed -i "s/version = \"0.0.0-snapshot\"/version = \"${TRAVIS_TAG#v}\"/g" Cargo.toml; fi - cargo install cargo-deb --version 2.3.0 - wget -O _releases/tc2-firmware.sha256 https://github.com/TheCacophonyProject/tc2-firmware/releases/download/v${RP2040_FIRMWARE_VERSION}/tc2-firmware.sha256 + - echo "Firmware hash is" + - cat _releases/tc2-firmware.sha256 - wget -O _releases/tc2-firmware https://github.com/TheCacophonyProject/tc2-firmware/releases/download/v${RP2040_FIRMWARE_VERSION}/tc2-firmware - cargo build --release --target=aarch64-unknown-linux-musl - cargo deb --target=aarch64-unknown-linux-musl --output tc2-agent_${TRAVIS_TAG#v}_arm64.deb diff --git a/src/main.rs b/src/main.rs index 34d03e1..3583e2a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -774,7 +774,6 @@ fn main() { let mut sent_reset_request = false; let mut has_failed = false; let mut got_startup_info = false; - let mut audio_mode = false; let mut radiometry_enabled = false; let mut firmware_version = 0; let mut lepton_serial_number = String::from(""); @@ -978,11 +977,7 @@ fn main() { radiometry_enabled = LittleEndian::read_u32(&chunk[0..4]) == 2; firmware_version = LittleEndian::read_u32(&chunk[4..8]); lepton_serial_number = format!("{}", LittleEndian::read_u32(&chunk[8..12])); - audio_mode = LittleEndian::read_u32(&chunk[12..16]) > 0; - RP2040_MODE.store(if audio_mode { 1 } else { 0 }, Ordering::Relaxed); - got_startup_info = true; - info!("Got startup info: radiometry enabled: {}, firmware version: {}, lepton serial #{} audio mode {}", radiometry_enabled, firmware_version, lepton_serial_number, audio_mode); if firmware_version != EXPECTED_RP2040_FIRMWARE_VERSION { exit_cleanly(&mut dbus_conn); info!("Unsupported firmware version, expected {}, got {}. Will reprogram RP2040.", EXPECTED_RP2040_FIRMWARE_VERSION, firmware_version); @@ -993,6 +988,11 @@ fn main() { } process::exit(0); } + + let audio_mode = LittleEndian::read_u32(&chunk[12..16]) > 0; + RP2040_MODE.store(if audio_mode { 1 } else { 0 }, Ordering::Relaxed); + info!("Got startup info: radiometry enabled: {}, firmware version: {}, lepton serial #{} audio mode {}", radiometry_enabled, firmware_version, lepton_serial_number, audio_mode); + if device_config.use_low_power_mode() && !radiometry_enabled && !device_config.is_audio_device() { exit_cleanly(&mut dbus_conn); error!("Low power mode is currently only supported on lepton sensors with radiometry or audio device, exiting.");