Browse Source

little tweaks here and there ;)

Malte Veerman 10 years ago
parent
commit
4dd8125fbe
2 changed files with 33 additions and 7 deletions
  1. 7 1
      lib/src/sensors.cpp
  2. 26 6
      package/contents/ui/PwmFan.qml

+ 7 - 1
lib/src/sensors.cpp

@@ -239,16 +239,21 @@ void PwmFan::continueTest()
     {
     case findingStop1:
         if (m_rpm > 0)
+        {
             setPwm(qMin(m_pwm * 0.95, m_pwm - 5.0));
+            m_zeroRpm = 0;
+        }
         else
         {
             if (m_zeroRpm < MAX_ERRORS_FOR_RPM_ZERO)
+            {
                 m_zeroRpm++;
+            }
             else
             {
                 m_testStatus = findingStart;
                 m_zeroRpm = 0;
-                m_testTimer.setInterval(250);
+                m_testTimer.setInterval(500);
                 qDebug() << "Start finding start value...";
             }
         }
@@ -272,6 +277,7 @@ void PwmFan::continueTest()
         if (m_rpm > 0)
         {
             setPwm(m_pwm - 1);
+            m_zeroRpm = 0;
             m_testTimer.start();
         }
         else

+ 26 - 6
package/contents/ui/PwmFan.qml

@@ -29,8 +29,8 @@ Rectangle {
     property QtObject fan
     property QtObject loader
     property QtObject systemdCom
-    property real minTemp: 30.0
-    property real maxTemp: 90.0
+    property real minTemp: 20.0
+    property real maxTemp: 100.0
     property int margin: 5
     property int minimizeDuration: 400
     property int unit: 0
@@ -163,7 +163,7 @@ Rectangle {
     }
 
     Canvas {
-        property int fontSize: Math.max(9, Math.min(height / 20, 20))
+        property int fontSize: Math.max(9, Math.min(height / 25, 20))
         property int leftPadding: fontSize * 4
         property int rightPadding: fontSize * 2
         property int topPadding: fontSize
@@ -188,14 +188,34 @@ Rectangle {
         }
 
         Rectangle {
+            property real unscaledTemp: fan.temp ? fan.temp.value : minTemp
+            property real unscaledPwm: fan.pwm
+            
             id: currentPwm
-            x: parent.scaleX(fan.temp ? fan.temp.value : minTemp) - width/2
-            y: parent.scaleY(fan.pwm) - height/2
+            x: parent.scaleX(unscaledTemp) - width/2
+            y: parent.scaleY(unscaledPwm) - height/2
             width: canvas.fontSize
             height: width
             radius: width / 2
             color: "black"
-            visible: parent.contains(Coordinates.centerOf(this))
+            visible: parent.contains(Coordinates.centerOf(this)) && fan.hasTemp
+            
+            Behavior on unscaledTemp {
+                SpringAnimation { 
+//                     duration: 2000
+                    epsilon: 0.1
+                    spring: 1.0
+                    damping: 0.5
+                }
+            }
+            Behavior on unscaledPwm {
+                SpringAnimation { 
+//                     duration: 2000
+                    epsilon: 0.1
+                    spring: 1.0
+                    damping: 0.5
+                }
+            }
         }
         PwmPoint {
             id: stopPoint