pub fn set_current_slot(&mut self, slot: Slot) -> Result<(), crate::partitions::Error> {
        if slot == Slot::None {
            self.flash.write(SLOT0_DATA_OFFSET, &[0xffu8; 0x20])?;
            self.flash.write(SLOT1_DATA_OFFSET, &[0xffu8; 0x20])?;
            return Ok(());
        }

        let (seq0, seq1) = self.get_slot_seq()?;

        let new_seq = {
            if seq0 == 0xffffffff && seq1 == 0xffffffff {
                1
            } else if seq0 == 0xffffffff {
                seq1 + 1
            } else if seq1 == 0xffffffff {
                seq0 + 1
            } else {
                u32::max(seq0, seq1) + 1
            }
        };

        let crc = crate::crypto::Crc32::new();
        let checksum = crc.crc(&new_seq.to_le_bytes());

        let mut buffer = OtaSelectEntry::default();
        self.flash.read(slot.offset(), buffer.as_bytes_mut())?;
        buffer.ota_seq = new_seq;
        buffer.crc = checksum;
        self.flash.write(slot.offset(), buffer.as_bytes_mut())?;

        Ok(())
    }
Sets the currently active OTA-slot.

Passing [Slot::None] will reset the OTA-data
esp-bootloader-esp-idf/src/ota.rs