Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
3.0 kB
3
Indexable
enum Command {
    ElectronicZoom {
        code: u32,
        data: u8, // 0x12
    },
    Zoom {
        code: u32,
        data: u8, // 0x15
    },
    Focus {
        code: u32,
        data: u8, // 0x18
    },
    VideoPolarity {
        code: u32,
        data: u8, // 0x31
    },
    GraphicsOnOff {
        code: u32,
        data: u8, // 0x36
    },
    PanelSwitch {
        code: u32,
        data: u8, // 0x4D
    },
    NUC {
        code: u32,
        data: u8, // 0x55
    },
    ChannelSelect {
        code: u32,
        data: u8, // 0xDF
    },
    LaserCommand {
        code: u32,
        data: u8, // 0xE9
    },
    CompassAzimuth {
        code: u32,
        data: u8, // 0x4B
    },
    OLEDSettings {
        code: u32,
        data: u8, // 0x68
    },
}

impl Command {
    const ELECTRONIC_ZOOM_2X: Command = Command::ElectronicZoom {
        code: 0x12,
        data: 1, // ezoom *2
    };

    const ELECTRONIC_ZOOM_4X: Command = Command::ElectronicZoom {
        code: 0x12,
        data: 2, // ezoom *4
    };

    const ZOOM_WIDE: Command = Command::Zoom {
        code: 0x15,
        data: 1, // Move toward wide
    };

    const ZOOM_NARROW: Command = Command::Zoom {
        code: 0x15,
        data: 2, // Move toward narrow
    };

    const FOCUS_FAR: Command = Command::Focus {
        code: 0x18,
        data: 2, // Move toward far
    };

    const FOCUS_NEAR: Command = Command::Focus {
        code: 0x18,
        data: 1, // Move toward near
    };

    const VIDEO_POLARITY_BLACK_HOT: Command = Command::VideoPolarity {
        code: 0x31,
        data: 0, // Black Hot
    };

    const VIDEO_POLARITY_WHITE_HOT: Command = Command::VideoPolarity {
        code: 0x31,
        data: 1, // White Hot
    };

    const GRAPHICS_OFF: Command = Command::GraphicsOnOff {
        code: 0x36,
        data: 0, // Not active
    };

    const GRAPHICS_ON: Command = Command::GraphicsOnOff {
        code: 0x36,
        data: 1, // Active
    };

    const PANEL_SWITCH_DISABLE: Command = Command::PanelSwitch {
        code: 0x4D,
        data: 0, // Disable
    };

    const PANEL_SWITCH_ENABLE: Command = Command::PanelSwitch {
        code: 0x4D,
        data: 1, // Enable
    };

    const NUC_NORMAL: Command = Command::NUC {
        code: 0x55,
        data: 0, // Normal
    };

    const CHANNEL_SELECT_ACTIVATE: Command = Command::ChannelSelect {
        code: 0xDF,
        data: 0, // Activate
    };

    const LASER_COMMAND_FIRE: Command = Command::LaserCommand {
        code: 0xE9,
        data: 0, // Fire
    };

    const COMPASS_AZIMUTH_REQUEST: Command = Command::CompassAzimuth {
        code: 0x4B,
        data: 0, // Request compass azimuth
    };

    const OLED_BRIGHTNESS_SET: Command = Command::OLEDSettings {
        code: 0x68,
        data: 0, // Set OLED brightness
    };
}
Leave a Comment