Skip to content
This repository has been archived by the owner on Aug 27, 2023. It is now read-only.

Commit

Permalink
configtool: add FORCE_SOFTWARE_PWM to configtool
Browse files Browse the repository at this point in the history
  • Loading branch information
Wurstnase committed Mar 21, 2017
1 parent 4882d19 commit fbe1af4
Show file tree
Hide file tree
Showing 25 changed files with 222 additions and 16 deletions.
8 changes: 8 additions & 0 deletions config/board.3drag.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO14, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.cnc-shield-v3.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO3, THERMISTOR_EXTRUDER)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.gen3.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,14 @@ DEFINE_TEMP_SENSOR(noheater, TT_INTERCOM, AIO0, 0)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.gen6.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ DEFINE_TEMP_SENSOR(extruder, TT_THERMISTOR, AIO5, THERMISTOR_EXTRUDER)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.gen7-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, PIO1_0,THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.gen7-v1.1-v1.3.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO2, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.gen7-v1.4.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.melzi.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.nanoheart-v1.0.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO7, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.pcbscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.ramps-v1.2.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO1, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.ramps-v1.3.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO14, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.rumba.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO11, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.sanguinololu-v1.1.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.sanguinololu-v1.2.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.sanguish.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.sinaptec-at328-02.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.teensy++-v2.0.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.teensy-v2.0.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO0, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
8 changes: 8 additions & 0 deletions config/board.tronxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ DEFINE_TEMP_SENSOR(bed, TT_THERMISTOR, AIO6, THERMISTOR_BED)
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
53 changes: 41 additions & 12 deletions configtool/addheaterdlg.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def __init__(self, parent, names, pins, font,

self.nameValid = (name != "")
self.maxPWMValid = (max_pwm != "")
self.pwmValid = (pwm != "")

sz = wx.BoxSizer(wx.VERTICAL)
gsz = wx.GridBagSizer()
Expand Down Expand Up @@ -78,14 +79,24 @@ def __init__(self, parent, names, pins, font,

gsz.Add(self.cbInv, pos = (3, 3))

self.cbPwm = wx.CheckBox(self, wx.ID_ANY, "PWM")
self.cbPwm.SetFont(font)
self.cbPwm.SetValue(int(pwm) != 0)
self.cbPwm.SetToolTipString("Use Pulse Width Modulation in case the "
"choosen pin allows to do so.")
lsz = wx.BoxSizer(wx.HORIZONTAL)
st = wx.StaticText(self, wx.ID_ANY, "PWM:", size = (60, -1),
style = wx.ALIGN_RIGHT)
st.SetFont(font)
lsz.Add(st, 1, wx.TOP, offsetChLabel)

self.tcPwm = wx.TextCtrl(self, wx.ID_ANY, pwm, size=(60, -1))
self.tcPwm.SetFont(font)
self.tcPwm.Bind(wx.EVT_TEXT, self.onPWM)
lsz.Add(self.tcPwm)
self.tcPwm.SetToolTipString("Use Pulse Width Modulation. "
"Hardware PWM if available or "
"Software PWM. When FORCE_SOFTWARE_PWM "
"is set, always software PWM for 1 and "
"hardware PWM for >= 2.")

gsz.AddSpacer((50, 15), pos = (1, 2))
gsz.Add(self.cbPwm, pos = (1, 3))
gsz.Add(lsz, pos = (1, 3))
gsz.AddSpacer((20, 20), pos = (4, 4))

sz.Add(gsz)
Expand Down Expand Up @@ -156,8 +167,29 @@ def onMaxPWM(self, evt):
if evt is not None:
evt.Skip()

def onPWM(self, evt):
tc = evt.GetEventObject()
w = tc.GetValue().strip()
if w == "":
self.pwmValid = False
else:
if int(w) >= 0:
self.pwmValid = True
else:
self.pwmValid = False

if self.pwmValid:
tc.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW))
else:
tc.SetBackgroundColour("pink")
tc.Refresh()

self.checkDlgValidity()
if evt is not None:
evt.Skip()

def checkDlgValidity(self):
if (self.nameValid and self.maxPWMValid):
if (self.nameValid and self.maxPWMValid and self.pwmValid):
self.bSave.Enable(True)
else:
self.bSave.Enable(False)
Expand All @@ -170,11 +202,8 @@ def getValues(self):
invert = "1"
else:
invert = "0"

if self.cbPwm.IsChecked():
pwm = "1"
else:
pwm = "0"

pwm = self.tcPwm.GetValue()

max_pwm = self.tcMaxPWM.GetValue()

Expand Down
8 changes: 8 additions & 0 deletions configtool/board.generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@
* *
\***************************************************************************/

/** \def FORCE_SOFTWARE_PWM
Force software pwm when pwm is sets to 1.
Normally any pwm value >= 1 will set the pin to hardware pwm, if available.
When FORCE_SOFTWARE_PWM is defined, pwm = 1 is always set to software pwm.
*/
// #define FORCE_SOFTWARE_PWM

/** \def HEATER_PIN
Heater pins a user should be able to choose from in configtool. All
commented out.
Expand Down
Loading

0 comments on commit fbe1af4

Please sign in to comment.