Browse Source

Some code fixes and movinig stuff around

i18n
Xose Pérez 6 years ago
parent
commit
d64f2916cb
7 changed files with 3150 additions and 3071 deletions
  1. +4
    -2
      code/espurna/ascheduler.ino
  2. +8
    -0
      code/espurna/config/general.h
  3. +0
    -5
      code/espurna/config/hardware.h
  4. BIN
      code/espurna/data/index.html.gz
  5. +2
    -1
      code/espurna/espurna.ino
  6. +3080
    -3063
      code/espurna/static/index.html.gz.h
  7. +56
    -0
      code/html/index.html

+ 4
- 2
code/espurna/ascheduler.ino View File

@ -7,6 +7,7 @@ Copyright (C) 2017 by faina09
*/ */
#if SCHEDULER_SUPPORT #if SCHEDULER_SUPPORT
#include <NtpClientLib.h> #include <NtpClientLib.h>
void _schWebSocketOnSend(JsonObject &root){ void _schWebSocketOnSend(JsonObject &root){
@ -44,7 +45,7 @@ void schSetup(){
} }
void schLoop(){ void schLoop(){
// Check if we should compare scheduled and actual times
// Check if we should compare scheduled and actual times
static unsigned long last_update = 0; static unsigned long last_update = 0;
static int sec = 0; static int sec = 0;
if ((millis() - last_update > ((SCH_UPDATE_SEC + 60 - sec)*1000)) || (last_update == 0)) { if ((millis() - last_update > ((SCH_UPDATE_SEC + 60 - sec)*1000)) || (last_update == 0)) {
@ -112,4 +113,5 @@ int diffTime(int schhour, int schminute){
return (hour - schhour) * 60 + minute - schminute; return (hour - schhour) * 60 + minute - schminute;
} }
} }
#endif
#endif // SCHEDULER_SUPPORT

+ 8
- 0
code/espurna/config/general.h View File

@ -671,6 +671,14 @@ PROGMEM const char* const custom_reset_string[] = {
#endif #endif
#endif #endif
// -----------------------------------------------------------------------------
// SCHEDULER
// -----------------------------------------------------------------------------
#define SCHEDULER_SUPPORT 1
#define SCH_UPDATE_SEC 5 // Scheduler perform switch at hh:mm:05
#define MAX_SCHEDULED 10
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// NTP // NTP
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------


+ 0
- 5
code/espurna/config/hardware.h View File

@ -23,7 +23,6 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Development boards // Development boards
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#define NODEMCU_LOLIN
#if defined(NODEMCU_LOLIN) #if defined(NODEMCU_LOLIN)
// Info // Info
@ -43,10 +42,6 @@
#define RELAY3_PIN 12 #define RELAY3_PIN 12
#define RELAY3_TYPE RELAY_TYPE_NORMAL #define RELAY3_TYPE RELAY_TYPE_NORMAL
#define SCHEDULER_SUPPORT 1
#define SCH_UPDATE_SEC 5 //scheduler perform switch at hh:mm:05
#define MAX_SCHEDULED 10
// LEDs // LEDs
#define LED1_PIN 2 #define LED1_PIN 2
#define LED1_PIN_INVERSE 1 #define LED1_PIN_INVERSE 1


BIN
code/espurna/data/index.html.gz View File


+ 2
- 1
code/espurna/espurna.ino View File

@ -438,7 +438,8 @@ void loop() {
#endif #endif
#if THINGSPEAK_SUPPORT #if THINGSPEAK_SUPPORT
tspkLoop(); tspkLoop();
#endif #if SCHEDULER_SUPPORT
#endif
#if SCHEDULER_SUPPORT
schLoop(); schLoop();
#endif #endif


+ 3080
- 3063
code/espurna/static/index.html.gz.h
File diff suppressed because it is too large
View File


+ 56
- 0
code/html/index.html View File

@ -100,6 +100,10 @@
<a href="#" class="pure-menu-link" data="panel-relay">SWITCHES</a> <a href="#" class="pure-menu-link" data="panel-relay">SWITCHES</a>
</li> </li>
<li class="pure-menu-item module module-relay">
<a href="#" class="pure-menu-link" data="panel-schedule">SCHEDULE</a>
</li>
<li class="pure-menu-item module module-color"> <li class="pure-menu-item module module-color">
<a href="#" class="pure-menu-link" data="panel-color">LIGHTS</a> <a href="#" class="pure-menu-link" data="panel-color">LIGHTS</a>
</li> </li>
@ -539,6 +543,27 @@
</div> </div>
</div> </div>
<div class="panel" id="panel-schedule">
<div class="header">
<h1>SCHEDULE</h1>
<h2>Turn switches ON and OFF based on the current time.</h2>
</div>
<div class="page">
<fieldset>
<div id="schedules"></div>
<button type="button" class="pure-button button-add-schedule">Add schedule</button>
</fieldset>
</div>
</div>
<div class="panel" id="panel-mqtt"> <div class="panel" id="panel-mqtt">
<div class="header"> <div class="header">
@ -1021,6 +1046,37 @@
</div> </div>
<div id="scheduleTemplate" class="template">
<div class="pure-g">
<label class="pure-u-sm-4-24 pure-u-1-3" for="sch_switch">Turn&nbsp;Switch&nbsp;No</label>
<div class="pure-u-sm-3-24 pure-u-1-3">
<input name="sch_switch" type="number" min="0" max="10" step="1" value="0" tabindex="0" />
</div>
<div class="pure-u-sm-3-24 pure-u-1-3">
<select name="sch_operation" tabindex="0">
<option value="0">OFF</option>
<option value="1">ON</option>
</select>
</div>
<label class="pure-u-sm-5-24 pure-u-1-3">at&nbsp;Time&nbsp;HH&nbsp;MM</label>
<div class="pure-u-sm-3-24 pure-u-1-3">
<input name="sch_hour" type="number" min="0" max="23" step="1" tabindex="0" value="0" />
</div>
<div class="pure-u-sm-3-24 pure-u-1-3">
<input name="sch_minute" type="number" min="0" max="59" step="1" tabindex="0" value="0" />
</div>
<div class="pure-u break"></div>
<label class="pure-u-sm-1-4 pure-u-1">on&nbsp;Weekdays:</label>
<div class="pure-u-sm-3-4 pure-u-1">
<div class="pure-u-1 weekDays-selector">
<input type="inbox" name="sch_weekdays" value="1,2,3,4,5,6,7" class="weekday" tabindex="0" />
</div>
<div class="pure-u-1 hint">1 = Sunday, 2 = Monday, ...</div>
</div>
<div class="pure-u-md-1-6 pure-u-1-4"><button type="button" class="pure-button button-del-schedule pure-u-5-6 pure-u-md-5-6">Del</button></div>
</div>
</div>
<div id="relayTemplate" class="template"> <div id="relayTemplate" class="template">
<div class="pure-g"> <div class="pure-g">
<div class="pure-u-1 pure-u-lg-1-4"><label>Switch #<span class="id"></span></label></div> <div class="pure-u-1 pure-u-lg-1-4"><label>Switch #<span class="id"></span></label></div>


Loading…
Cancel
Save