1. Craig Swank
  2. gadgets

Commits

Craig Swank  committed b53824d

forgot to write to run in pwm

  • Participants
  • Parent commits 0797bf8
  • Branches master

Comments (0)

Files changed (2)

File gadgets/devices/valve/triggers/volume_converter.py

View file
     def get_volume(self, starting_volume, time):
         starting_volume = starting_volume * 1000.0 #convert to cubic centimeters
         height = self._get_height(starting_volume)
-        dh = math.fabs(((time / self.k) ** 2) - (2 * (time / self.k) * pow(height, 0.5)))
+        try:
+            dh = math.fabs(((time / self.k) ** 2) - (2 * (time / self.k) * pow(height, 0.5)))
+        except ValueError:
+            return 0
         return (self.tank_area * dh) / 1000.0
     
     def get_drain_time(self, starting_volume, volume):

File gadgets/io/pwm.py

View file
         on.
         """
         if self._current_value != value:
+            self._write_value('run', '1')
             self._current_value = value
             value = 1000000000 * (value / 100)
             self._write_value('duty', value)