Speed control, 100 or 400 kHz
This commit is contained in:
parent
3c5b894b7e
commit
895f5a3941
|
@ -88,7 +88,10 @@ class Frame(wx.Frame):
|
||||||
self.label_voltage = wx.StaticText(self, label = "-", style = wx.ALIGN_RIGHT)
|
self.label_voltage = wx.StaticText(self, label = "-", style = wx.ALIGN_RIGHT)
|
||||||
self.label_current = wx.StaticText(self, label = "-", style = wx.ALIGN_RIGHT)
|
self.label_current = wx.StaticText(self, label = "-", style = wx.ALIGN_RIGHT)
|
||||||
self.label_temp = wx.StaticText(self, label = "-", style = wx.ALIGN_RIGHT)
|
self.label_temp = wx.StaticText(self, label = "-", style = wx.ALIGN_RIGHT)
|
||||||
self.label_speed = wx.StaticText(self, label = "-", style = wx.ALIGN_RIGHT)
|
self.label_speed = wx.Choice(self, choices = ["100", "400"])
|
||||||
|
self.label_speed.Bind(wx.EVT_CHOICE, self.set_speed)
|
||||||
|
self.label_sda = wx.StaticText(self, label = "-", style = wx.ALIGN_RIGHT)
|
||||||
|
self.label_scl = wx.StaticText(self, label = "-", style = wx.ALIGN_RIGHT)
|
||||||
self.label_uptime = wx.StaticText(self, label = "-", style = wx.ALIGN_RIGHT)
|
self.label_uptime = wx.StaticText(self, label = "-", style = wx.ALIGN_RIGHT)
|
||||||
|
|
||||||
self.dynamic = [
|
self.dynamic = [
|
||||||
|
@ -96,6 +99,8 @@ class Frame(wx.Frame):
|
||||||
self.label_current,
|
self.label_current,
|
||||||
self.label_temp,
|
self.label_temp,
|
||||||
self.label_speed,
|
self.label_speed,
|
||||||
|
self.label_sda,
|
||||||
|
self.label_scl,
|
||||||
self.label_uptime
|
self.label_uptime
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -142,11 +147,15 @@ class Frame(wx.Frame):
|
||||||
[self.hot(i, False) for i in self.heat]
|
[self.hot(i, False) for i in self.heat]
|
||||||
self.started = False
|
self.started = False
|
||||||
|
|
||||||
self.dev_widgets = vbox([
|
info = vbox([
|
||||||
hcenter(pair(self.txVal, txButton)),
|
pair(label("Serial"), self.label_serial),
|
||||||
hcenter(pair(self.rxVal, hbox([self.rxCount, rxButton]))),
|
pair(label("Voltage"), self.label_voltage),
|
||||||
label(""),
|
pair(label("Current"), self.label_current),
|
||||||
hcenter(self.stop_button),
|
pair(label("Temp."), self.label_temp),
|
||||||
|
pair(label("SDA"), self.label_sda),
|
||||||
|
pair(label("SCL"), self.label_scl),
|
||||||
|
pair(label("Running"), self.label_uptime),
|
||||||
|
pair(label("Speed"), self.label_speed),
|
||||||
])
|
])
|
||||||
|
|
||||||
vb = vbox([
|
vb = vbox([
|
||||||
|
@ -156,29 +165,38 @@ class Frame(wx.Frame):
|
||||||
hcenter(self.ckM),
|
hcenter(self.ckM),
|
||||||
hcenter(self.reset_button),
|
hcenter(self.reset_button),
|
||||||
label(""),
|
label(""),
|
||||||
hcenter(pair(
|
hcenter(info),
|
||||||
vbox([
|
# hcenter(pair(
|
||||||
label("Serial"),
|
# vbox([
|
||||||
label("Voltage"),
|
# label("Serial"),
|
||||||
label("Current"),
|
# label("Voltage"),
|
||||||
label("Temp."),
|
# label("Current"),
|
||||||
label("Speed"),
|
# label("Temp."),
|
||||||
label("Running"),
|
# label("Speed"),
|
||||||
]),
|
# label("SDA"),
|
||||||
vbox([
|
# label("SCL"),
|
||||||
self.label_serial,
|
# label("Running"),
|
||||||
self.label_voltage,
|
# ]),
|
||||||
self.label_current,
|
# vbox([
|
||||||
self.label_temp,
|
# self.label_serial,
|
||||||
self.label_speed,
|
# self.label_voltage,
|
||||||
self.label_uptime,
|
# self.label_current,
|
||||||
])
|
# self.label_temp,
|
||||||
)),
|
# self.label_speed,
|
||||||
|
# self.label_sda,
|
||||||
|
# self.label_scl,
|
||||||
|
# self.label_uptime,
|
||||||
|
# ])
|
||||||
|
# )),
|
||||||
|
|
||||||
label(""),
|
label(""),
|
||||||
hcenter(devgrid),
|
hcenter(devgrid),
|
||||||
label(""),
|
label(""),
|
||||||
self.dev_widgets,
|
hcenter(pair(self.txVal, txButton)),
|
||||||
|
hcenter(pair(self.rxVal, hbox([self.rxCount, rxButton]))),
|
||||||
|
label(""),
|
||||||
|
hcenter(self.stop_button),
|
||||||
|
|
||||||
label(""),
|
label(""),
|
||||||
])
|
])
|
||||||
self.SetSizerAndFit(vb)
|
self.SetSizerAndFit(vb)
|
||||||
|
@ -248,12 +266,16 @@ class Frame(wx.Frame):
|
||||||
|
|
||||||
def refresh(self, e):
|
def refresh(self, e):
|
||||||
if self.sd and not self.monitor:
|
if self.sd and not self.monitor:
|
||||||
|
lowhigh = ["LOW", "HIGH"]
|
||||||
self.sd.getstatus()
|
self.sd.getstatus()
|
||||||
self.label_serial.SetLabel(self.sd.serial)
|
self.label_serial.SetLabel(self.sd.serial)
|
||||||
self.label_voltage.SetLabel("%.2f V" % self.sd.voltage)
|
self.label_voltage.SetLabel("%.2f V" % self.sd.voltage)
|
||||||
self.label_current.SetLabel("%d mA" % self.sd.current)
|
self.label_current.SetLabel("%d mA" % self.sd.current)
|
||||||
self.label_temp.SetLabel("%.1f C" % self.sd.temp)
|
self.label_temp.SetLabel("%.1f C" % self.sd.temp)
|
||||||
self.label_speed.SetLabel("%d kHz" % self.sd.speed)
|
self.label_speed.SetSelection({100:0, 400:1}[self.sd.speed])
|
||||||
|
|
||||||
|
self.label_sda.SetLabel(lowhigh[self.sd.sda])
|
||||||
|
self.label_scl.SetLabel(lowhigh[self.sd.scl])
|
||||||
days = self.sd.uptime // (24 * 3600)
|
days = self.sd.uptime // (24 * 3600)
|
||||||
rem = self.sd.uptime % (24 * 3600)
|
rem = self.sd.uptime % (24 * 3600)
|
||||||
hh = rem // 3600
|
hh = rem // 3600
|
||||||
|
@ -287,6 +309,12 @@ class Frame(wx.Frame):
|
||||||
if self.monitor:
|
if self.monitor:
|
||||||
[self.hot(i, False) for i in self.heat]
|
[self.hot(i, False) for i in self.heat]
|
||||||
|
|
||||||
|
def set_speed(self, e):
|
||||||
|
w = e.EventObject
|
||||||
|
s = int(w.GetString(w.GetCurrentSelection()))
|
||||||
|
print(s)
|
||||||
|
self.sd.setspeed(s)
|
||||||
|
|
||||||
def hot(self, i, s):
|
def hot(self, i, s):
|
||||||
l = self.heat[i]
|
l = self.heat[i]
|
||||||
if s:
|
if s:
|
||||||
|
|
Loading…
Reference in New Issue