Commit 958bd9d1 authored by Martin Cífka's avatar Martin Cífka
Browse files

temporary fix for RAW images: force resolution to be 6912x3456 JPEG

parent 3a711ca4
Loading
Loading
Loading
Loading
Loading
+268 B (9.38 MiB)

File changed.

No diff preview for this file type.

+1 −1
Original line number Diff line number Diff line
outfile="miphoto-exec"
outfile=$1
buildopts="-std=c++17 -Wno-psabi -static-libstdc++ -DUWS_NO_ZLIB -Isrc/lib/ArduinoJson -Isrc/lib/uSockets -Isrc/lib/uWebSockets -Isrc/lib/easyexif -Lsrc/lib -lpthread -lstdc++fs -l:uSockets.a -l:exif.a"
sources=$(ls src/*.cpp 2>/dev/null | tr '\r\n' ' ') || (echo "No .cpp files found" && exit 1)

+3 −3
Original line number Diff line number Diff line
#!/bin/bash
set -euo pipefail

outfile="miphoto-exec"
cd $(dirname $0)

usage=$(echo -e "Usage: run.sh [OPTIONS] \n\t-b\tbuild \n\t-r\tcopy to camera and run")
@@ -31,7 +31,7 @@ done

if [ "$build" = true ] ; then
    sudo docker build -t mi_camera_sdk . 
    sudo docker run -it --rm -v "$PWD":/workdir mi_camera_sdk bash docker.sh
    sudo docker run -it --rm -v "$PWD":/workdir mi_camera_sdk bash docker.sh $outfile
fi


+11 −1
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ public:
        GetSetMode = 4611, //button press
        GetSetPhotoWB = 5168,//TODO

        GetSetPhotoResolution = 4872,

        ImgCaptured = 8193,

        GetCameraSettings = 4364,
@@ -171,7 +173,15 @@ public:
        Percent50 = 2,
        Percent75 = 3,
        Percent100 = 4,
        ChargeFull = 68
        ChargeFull = 68,
    };

    enum class ParamPhotoResolution
    {
        R_6912x3456 = 0,
        R_3456x1728_stitched = 1,
        R_6912x3456_stitched = 2,
        R_6912x3456_RAW = 3
    };

    /**
+28 −2
Original line number Diff line number Diff line
@@ -226,6 +226,18 @@ bool Commander::setMode(Codes::ParamMode mode)
    return true;
}

bool Commander::setPhotoResolution(Codes::ParamPhotoResolution resolution)
{
    if (_resolution != resolution) // set only if the value has changed
    {
        if (setParam(Codes::MsgId::GetSetPhotoResolution, resolution))
            _resolution = resolution;
        else
            return false;
    }
    return true;
}

bool Commander::setAutoPowerOff(size_t minutes)
{
    if (_autoPowerOff != minutes) // set only if the value has changed
@@ -255,6 +267,18 @@ bool Commander::getMode()
        return false;
}

bool Commander::getPhotoResolution()
{
    int resolution;
    if (getParam(Codes::MsgId::GetSetPhotoResolution, resolution))
    {
        _resolution = (Codes::ParamPhotoResolution)resolution;
        return true;
    }
    else
        return false;
}


template <typename T>
bool Commander::setParam(Codes::MsgId msgid, T param)
@@ -780,7 +804,8 @@ void Commander::disconnectSocket()

bool Commander::connectCommander()
{
    if (getToken() && getCameraSettings() && getMode() && getAutoPowerOff())
    if (getToken() && getCameraSettings() && getMode() && getAutoPowerOff() 
     && getPhotoResolution() && setPhotoResolution(Codes::ParamPhotoResolution::R_6912x3456)) /*Temporary solution - set the resolution to 6912x3456 JPEG*/
    {
        return true;
    }
@@ -799,6 +824,7 @@ void Commander::invalidateCachedSettings()
    _speed = (Codes::Speed)-1;
    _photoWB = (Codes::ParamWB)(-1);
    _mode = (Codes::ParamMode)-1;
    _resolution = (Codes::ParamPhotoResolution)-1;
    
    _bracketingBuiltIn = (Codes::ParamBracketingBuiltIn)-1;
}
Loading