diff options
| author | Donald Davis <don@haifisch.local> | 2019-01-23 09:49:48 -0800 |
|---|---|---|
| committer | Donald Davis <don@haifisch.local> | 2019-01-23 09:49:48 -0800 |
| commit | c7e3784dbf23828928b52752b89f6b7c4e96a396 (patch) | |
| tree | caafc9cbcbc5190497d7c9d97a093f385bbc7e45 | |
| parent | fc62e8d29f215b0e85cb62b1273636bc2f2686ba (diff) | |
new wxpython syntax
| -rwxr-xr-x | console/EMSConsole.py | 2 | ||||
| -rwxr-xr-x | console/consoleFrame.py | 64 | ||||
| -rw-r--r-- | platformio.ini | 4 | ||||
| -rwxr-xr-x | src/Clock.cpp | 10 | ||||
| -rwxr-xr-x | src/Clock.h | 20 |
5 files changed, 52 insertions, 48 deletions
diff --git a/console/EMSConsole.py b/console/EMSConsole.py index 4378fdf..39b1e2a 100755 --- a/console/EMSConsole.py +++ b/console/EMSConsole.py @@ -48,7 +48,7 @@ def log_to_google_app(key,verb=':',value=None): device=application.main.device if value is not None and device.device_ssn_string is not None : try: - print "LOG:(" + device.device_ssn_string + ")" + value + #print "LOG:(" + device.device_ssn_string + ")" + value ssn=device.device_ssn_string (timestamp,ambient,chiller1,chiller2,air1,air2,chiller, fan,soh,state) = value.split(',') diff --git a/console/consoleFrame.py b/console/consoleFrame.py index fa4a08b..14156e6 100755 --- a/console/consoleFrame.py +++ b/console/consoleFrame.py @@ -51,66 +51,66 @@ class EMSConsole(wx.Frame): self.outSizer=wx.BoxSizer(orient=wx.VERTICAL)
self.boxSizer1 = wx.BoxSizer(orient=wx.HORIZONTAL)
self.consoleSizer=wx.BoxSizer(orient=wx.VERTICAL)
- self.consoleSizer.AddWindow(self.emsOutput, 2, border=0,flag=wx.EXPAND|wx.ALL)
- self.consoleSizer.AddWindow(self.emsCommand, 0, border=1,
+ self.consoleSizer.Add(self.emsOutput, 2, border=0,flag=wx.EXPAND|wx.ALL)
+ self.consoleSizer.Add(self.emsCommand, 0, border=1,
flag=wx.EXPAND | wx.ALL | wx.ALIGN_LEFT)
self.runSizer = wx.BoxSizer(orient=wx.VERTICAL)
self.runSizer1=wx.BoxSizer(orient=wx.VERTICAL)
- self.runSizer1.AddWindow(wx.StaticText(label=u'SEC. REMAINING',
+ self.runSizer1.Add(wx.StaticText(label=u'SEC. REMAINING',
parent=self,
style = wx.ALIGN_CENTER),
0, border=10,
flag=wx.CENTER)
- self.runSizer1.AddWindow(self.TRM,1, border=10,
+ self.runSizer1.Add(self.TRM,1, border=10,
flag=wx.EXPAND|wx.ALL)
#self.runSizer1.AddSpacer((30,20),1)
- self.runSizer.AddSizer(self.runSizer1,1, border=0, flag=wx.CENTER)
- self.runSizer.AddWindow(self.RUN,0, border=0, flag=wx.CENTER)
- self.runSizer.AddWindow(self.TMS, 1, border=0,flag=wx.EXPAND)
+ self.runSizer.Add(self.runSizer1,1, border=0, flag=wx.CENTER)
+ self.runSizer.Add(self.RUN,0, border=0, flag=wx.CENTER)
+ self.runSizer.Add(self.TMS, 1, border=0,flag=wx.EXPAND)
#self.runSizer.AddSpacer((20,20))
self.pumpSizer = wx.BoxSizer(orient=wx.VERTICAL)
- self.pumpSizer.AddWindow(self.MUP,1, border=0, flag=wx.CENTER|wx.ALIGN_CENTER)
+ self.pumpSizer.Add(self.MUP,1, border=0, flag=wx.CENTER|wx.ALIGN_CENTER)
self.pumpSizer2 = wx.BoxSizer(orient=wx.VERTICAL)
- self.pumpSizer2.AddWindow(wx.StaticText(label=u'PLATE PRESSURE',
+ self.pumpSizer2.Add(wx.StaticText(label=u'PLATE PRESSURE',
parent=self),
0,border=0,flag=wx.CENTER)
- self.pumpSizer2.AddWindow(self.PS1,1, border=10,
+ self.pumpSizer2.Add(self.PS1,1, border=10,
flag=wx.EXPAND|wx.ALL)
- self.pumpSizer2.AddWindow(wx.StaticText(label=u'(Approximate)',parent=self,
+ self.pumpSizer2.Add(wx.StaticText(label=u'(Approximate)',parent=self,
style = wx.ALIGN_CENTER
),
0, border=0,flag=wx.CENTER)
- self.pumpSizer.AddSizer(self.pumpSizer2,1, border=0, flag=wx.CENTER)
- self.pumpSizer.AddWindow(self.MDN,1, border=0, flag=wx.CENTER)
+ self.pumpSizer.Add(self.pumpSizer2,1, border=0, flag=wx.CENTER)
+ self.pumpSizer.Add(self.MDN,1, border=0, flag=wx.CENTER)
self.pumpSizer1=wx.BoxSizer(orient=wx.HORIZONTAL)
- self.pumpSizer1.AddWindow(self.SOL, 0, border=0, flag=wx.ALIGN_CENTER)
- self.pumpSizer1.AddWindow(self.PMS, 0, border=0, flag=wx.ALIGN_CENTER)
- self.pumpSizer.AddSizer(self.pumpSizer1,0, flag=wx.CENTER)
+ self.pumpSizer1.Add(self.SOL, 0, border=0, flag=wx.ALIGN_CENTER)
+ self.pumpSizer1.Add(self.PMS, 0, border=0, flag=wx.ALIGN_CENTER)
+ self.pumpSizer.Add(self.pumpSizer1,0, flag=wx.CENTER)
self.tempSizer = wx.BoxSizer(orient=wx.VERTICAL)
self.tempSizer2 = wx.BoxSizer(orient=wx.HORIZONTAL)
- self.tempSizer2.AddWindow(self.TS1, 0, border=5,flag=wx.EXPAND|wx.BOTTOM)
- self.tempSizer2.AddWindow(self.TS2, 0, border=5,flag=wx.EXPAND|wx.BOTTOM)
- self.tempSizer2.AddWindow(self.TMP, 1,
+ self.tempSizer2.Add(self.TS1, 0, border=5,flag=wx.EXPAND|wx.BOTTOM)
+ self.tempSizer2.Add(self.TS2, 0, border=5,flag=wx.EXPAND|wx.BOTTOM)
+ self.tempSizer2.Add(self.TMP, 1,
border=5,
flag=wx.CENTER)
- self.tempSizer2.AddSpacer((30,10))
- self.tempSizer.AddSizer(self.tempSizer2, 1, border=1, flag=wx.CENTER)
- self.tempSizer.AddWindow(self.HSW, 0, border=0, flag=wx.CENTER)
+ self.tempSizer2.Add(0,30,10)
+ self.tempSizer.Add(self.tempSizer2, 1, border=1, flag=wx.CENTER)
+ self.tempSizer.Add(self.HSW, 0, border=0, flag=wx.CENTER)
- self.boxSizer1.AddSizer(self.consoleSizer, 1, border=0, flag=wx.CENTER)
- self.boxSizer1.AddSizer(self.pumpSizer, 1, border=0, flag=wx.CENTER)
- self.boxSizer1.AddSizer(self.runSizer, 1, border=0, flag=wx.CENTER)
- self.boxSizer1.AddSizer(self.tempSizer, 1, border=0, flag=wx.CENTER)
- self.outSizer.AddSizer(self.boxSizer1, 1, border=0, flag=wx.CENTER)
- self.outSizer.AddWindow(self.statusBar1, 0, border=5, flag=wx.BOTTOM)
+ self.boxSizer1.Add(self.consoleSizer, 1, border=0, flag=wx.CENTER)
+ self.boxSizer1.Add(self.pumpSizer, 1, border=0, flag=wx.CENTER)
+ self.boxSizer1.Add(self.runSizer, 1, border=0, flag=wx.CENTER)
+ self.boxSizer1.Add(self.tempSizer, 1, border=0, flag=wx.CENTER)
+ self.outSizer.Add(self.boxSizer1, 1, border=0, flag=wx.CENTER)
+ self.outSizer.Add(self.statusBar1, 0, border=5, flag=wx.BOTTOM)
self.SetSizer(self.outSizer)
@@ -132,7 +132,7 @@ class EMSConsole(wx.Frame): self.emsCommand = wx.TextCtrl(
name=u'emsCommand', parent=self,
- size=(200, 22), style=wx.TE_PROCESS_ENTER|wx.PROCESS_ENTER,
+ size=(200, 22), style=wx.TE_PROCESS_ENTER,
value=u'')
self.emsCommand.SetInsertionPoint(1)
@@ -175,7 +175,7 @@ class EMSConsole(wx.Frame): + os.sep +"pause.png",
wx.BITMAP_TYPE_ANY)
- self.RUN = wx.wx.BitmapButton(parent=self, id=wx.ID_ANY, bitmap=self.playb,
+ self.RUN = wx.BitmapButton(parent=self, id=wx.ID_ANY, bitmap=self.playb,
size=(self.playb.GetWidth(),
self.playb.GetHeight()),
style=wx.NO_BORDER|wx.BU_EXACTFIT)
@@ -220,7 +220,7 @@ class EMSConsole(wx.Frame): self.upb = wx.Bitmap(os.path.dirname(os.path.realpath(__file__))
+ os.sep +"up.png",
wx.BITMAP_TYPE_ANY)
- self.MUP = wx.wx.BitmapButton(parent=self, id=wx.ID_ANY,
+ self.MUP = wx.BitmapButton(parent=self, id=wx.ID_ANY,
bitmap=self.upb,
size=(self.upb.GetWidth(),
self.upb.GetHeight()),
@@ -231,7 +231,7 @@ class EMSConsole(wx.Frame): self.dnb = wx.Bitmap(os.path.dirname(os.path.realpath(__file__))
+ os.sep +"dn.png",
wx.BITMAP_TYPE_ANY)
- self.MDN = wx.wx.BitmapButton(parent=self, id=wx.ID_ANY, bitmap=self.dnb,
+ self.MDN = wx.BitmapButton(parent=self, id=wx.ID_ANY, bitmap=self.dnb,
size=(self.dnb.GetWidth(),
self.dnb.GetHeight()),
style=wx.NO_BORDER|wx.BU_EXACTFIT)
diff --git a/platformio.ini b/platformio.ini index 36a0445..b1cdbc4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -8,7 +8,7 @@ ; Please visit documentation for the other options and examples ; http://docs.platformio.org/page/projectconf.html -[env:adafruit_feather_m0] +[env:adafruit_itsybitsy_m4] platform = atmelsam -board = adafruit_feather_m0 +board = adafruit_itsybitsy_m4 framework = arduino diff --git a/src/Clock.cpp b/src/Clock.cpp index c2618cb..fff797f 100755 --- a/src/Clock.cpp +++ b/src/Clock.cpp @@ -59,9 +59,9 @@ /* Create an rtc object mebby should be private to the class JOE?? */ // add preprocessor code here for non M0 systems. -#ifdef ARDUINO_SAMD_ZERO -RTCZero rtc; -#endif +//#ifdef ARDUINO_SAMD_ZERO +//RTCZero rtc; +//#endif /* calculate build date and time (this should be referenceable from monitor for SWV ... */ const byte build_seconds = ((__TIME__[6] - '0') * 10 + __TIME__[7] - '0'); const byte build_minutes = ((__TIME__[3] - '0') * 10 + __TIME__[4] - '0'); @@ -114,7 +114,11 @@ void Clock::init() // bracket with pre-processor defs .... bool Clock::RTCIsRunning(void) { + #if defined(RTC_MODE2_CTRL_ENABLE) return (RTC->MODE2.CTRL.reg & RTC_MODE2_CTRL_ENABLE); + #else + return true; + #endif } const uint8_t daysInMonth [] { 31,28,31,30,31,30,31,31,30,31,30,31 }; diff --git a/src/Clock.h b/src/Clock.h index 690d72a..6812923 100755 --- a/src/Clock.h +++ b/src/Clock.h @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. *----------------------------------------------------------------------------- * - * + * * */ @@ -46,7 +46,7 @@ #define CHARS_IN_TIMESTAMP 20 // add preprocessor code here for non M0 systems. -#ifdef ARDUINO_SAMD_ZERO +#if defined(ARDUINO_ARCH_SAMD) #include <RTCZero.h> extern RTCZero rtc; #endif @@ -61,14 +61,14 @@ class Clock { private: - + public: - - + + /*---------------------------------------------------------------------- * Monitor Callbacks *--------------------------------------------------------------------*/ - + static void TIM (uint8_t kwIndex, uint8_t verb,char *args) { static char thetimestamp[CHARS_IN_TIMESTAMP]; if (verb == '!') { @@ -77,7 +77,7 @@ public: timeStamp(thetimestamp); monitor.update("TIM","%s",thetimestamp); } - + static void NOW (uint8_t kwIndex, uint8_t verb,char *args) { static char intbuff[25]; if (verb == '!') { @@ -85,9 +85,9 @@ public: } ultoa(clock.time(),intbuff,10); monitor.update("NOW","%s",intbuff); - + } - + Clock() {} ; void init(); @@ -95,7 +95,7 @@ public: void set(time_t); time_t get(); void set(const char *); - + // need to generalize this at some point. #if 0 uint16_t year() const { return 2000 + yOff; } |
