[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kstars] kstars/ekos: Reject invalid frame requests
From:       Jasem Mutlaq <mutlaqja () ikarustech ! com>
Date:       2016-08-31 20:06:42
Message-ID: E1bfBmU-0002YM-4F () code ! kde ! org
[Download RAW message or body]

Git commit d53f6ffbc527479c3b9971a64f83a5f489e455d3 by Jasem Mutlaq.
Committed on 31/08/2016 at 20:06.
Pushed by mutlaqja into branch 'master'.

Reject invalid frame requests

M  +30   -18   kstars/ekos/capture.cpp
M  +1    -1    kstars/ekos/capture.h

http://commits.kde.org/kstars/d53f6ffbc527479c3b9971a64f83a5f489e455d3

diff --git a/kstars/ekos/capture.cpp b/kstars/ekos/capture.cpp
index 540fd81..2ec6846 100644
--- a/kstars/ekos/capture.cpp
+++ b/kstars/ekos/capture.cpp
@@ -515,7 +515,7 @@ void Capture::checkCCD(int ccdNum)
     }
 }
 
-void Capture::updateFrameProperties(bool reload)
+void Capture::updateFrameProperties(bool reset)
 {
     int x,y,w,h;
     int binx=1,biny=1;
@@ -544,6 +544,10 @@ void Capture::updateFrameProperties(bool reload)
 
     if (currentCCD->getMinMaxStep(frameProp, "WIDTH", &min, &max, &step))
     {
+
+        if (min == max)
+            return;
+
         if (step == 0)
             xstep = (int) max * 0.05;
         else
@@ -556,9 +560,14 @@ void Capture::updateFrameProperties(bool reload)
             frameWIN->setSingleStep(xstep);
         }
     }
+    else
+        return;
 
     if (currentCCD->getMinMaxStep(frameProp, "HEIGHT", &min, &max, &step))
     {
+        if (min == max)
+            return;
+
         if (step == 0)
             ystep = (int) max * 0.05;
         else
@@ -571,9 +580,14 @@ void Capture::updateFrameProperties(bool reload)
             frameHIN->setSingleStep(ystep);
         }
     }
+    else
+        return;
 
     if (currentCCD->getMinMaxStep(frameProp, "X", &min, &max, &step))
     {
+        if (min == max)
+            return;
+
         if (step == 0)
             step = xstep;
 
@@ -584,9 +598,14 @@ void Capture::updateFrameProperties(bool reload)
             frameXIN->setSingleStep(step);
         }
     }
+    else
+        return;
 
     if (currentCCD->getMinMaxStep(frameProp, "Y", &min, &max, &step))
     {
+        if (min == max)
+            return;
+
         if (step == 0)
             step = ystep;
 
@@ -597,28 +616,21 @@ void Capture::updateFrameProperties(bool reload)
             frameYIN->setSingleStep(step);
         }
     }
+    else
+        return;
 
-    if ( reload || frameSettings.contains(targetChip) == false)
+    if (reset || frameSettings.contains(targetChip) == false)
     {
         QVariantMap settings;
-        bool haveFrame=false, haveBinning=false;
 
-        if ( (haveFrame = targetChip->getFrame(&x,&y,&w,&h)) )
-        {
-            settings["x"] = x;
-            settings["y"] = y;
-            settings["w"] = w;
-            settings["h"] = h;
-        }
-
-        if ( (haveBinning = targetChip->getBinning(&binx, &biny)) )
-        {
-            settings["binx"] = binx;
-            settings["biny"] = biny;
-        }
+        settings["x"] = 0;
+        settings["y"] = 0;
+        settings["w"] = frameWIN->maximum();
+        settings["h"] = frameHIN->maximum();
+        settings["binx"] = 1;
+        settings["biny"] = 1;
 
-        if (haveFrame && haveBinning)
-            frameSettings[targetChip] = settings;
+        frameSettings[targetChip] = settings;
     }
 
     if (frameSettings.contains(targetChip))
diff --git a/kstars/ekos/capture.h b/kstars/ekos/capture.h
index c0bed20..79e0d1d 100644
--- a/kstars/ekos/capture.h
+++ b/kstars/ekos/capture.h
@@ -445,7 +445,7 @@ private:
     void setBusy(bool enable);
     bool resumeSequence();
     void startNextExposure();
-    void updateFrameProperties(bool reload=false);
+    void updateFrameProperties(bool reset=false);
     void prepareJob(SequenceJob *job);
     void syncGUIToJob(SequenceJob *job);
     bool processJobInfo(XMLEle *root);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic