Skip to content

Commit

Permalink
fixed millis rollover, added support for IV12 clock, added copyright …
Browse files Browse the repository at this point in the history
…claims, version bump
  • Loading branch information
mcer12 committed Jun 20, 2021
1 parent e9a835c commit 80c87cc
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 6 deletions.
9 changes: 7 additions & 2 deletions Firmware/FLORA_FIRMWARE/FLORA_FIRMWARE.ino
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* GNU General Public License v3.0
* Copyright (c) 2019 Martin Cerny
*/

#include <FS.h>
#include <ArduinoJson.h>
#include <math.h>
Expand Down Expand Up @@ -34,7 +39,7 @@

#define AP_NAME "FLORA_"
#define FW_NAME "FLORA"
#define FW_VERSION "5.0"
#define FW_VERSION "5.1"
#define CONFIG_TIMEOUT 300000 // 300000 = 5 minutes

// ONLY CHANGE DEFINES BELOW IF YOU KNOW WHAT YOU'RE DOING!
Expand All @@ -58,7 +63,7 @@ const char* update_password = "flora";
const char* ntpServerName = "pool.ntp.org";

const int dotsAnimationSteps = 2000; // dotsAnimationSteps * TIMER_INTERVAL_uS = one animation cycle time in microseconds
const uint8_t PixelCount = 12; // Addressable LED count
const uint8_t PixelCount = 14; // Addressable LED count

HsbColor red[] = {
HsbColor(RgbColor(100, 0, 0)), // LOW
Expand Down
11 changes: 8 additions & 3 deletions Firmware/FLORA_FIRMWARE/config_portal.ino
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ static const char html_footer[] PROGMEM =
"</script>"
"</body> </html>";

// iro.js v5.5.1
/*!
* iro.js v5.5.1
* 2016-2021 James Daniel
* Licensed under MPL 2.0
* github.com/jaames/iro.js
*/
static const char iro[] PROGMEM =
"<script>"
"!function(t,n){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=n():\"function\"==typeof define&&define.amd?define(n):(t=t||self).iro=n()}(this,function(){\"use strict\";var m,s,n,i,o,x={},j=[],r=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|^--/i;function M(t,n){for(var i in n)t[i]=n[i];return t}function y(t){var n=t.parentNode;n&&n.removeChild(t)}function h(t,n,i){var r,e,u,o,l=arguments;if(n=M({},n),3<arguments.length)for(i=[i],r=3;r<arguments.length;r++)i.push(l[r]);if(null!=i&&(n.children=i),null!=t&&null!=t.defaultProps)for(e in t.defaultProps)void 0===n[e]&&(n[e]=t.defaultProps[e]);return o=n.key,null!=(u=n.ref)&&delete n.ref,null!=o&&delete n.key,c(t,n,o,u)}function c(t,n,i,r){var e={type:t,props:n,key:i,ref:r,n:null,i:null,e:0,o:null,l:null,c:null,constructor:void 0};return m.vnode&&m.vnode(e),e}function O(t){return t.children}function I(t,n){this.props=t,this.context=n}function w(t,n){if(null==n)return t.i?w(t.i,t.i.n.indexOf(t)+1):null;for(var i;n<t.n.length;n++)if(null!=(i=t.n[n])&&null!=i.o)return i.o;return\"function\"==typeof t.type?w(t):null}function a(t){var n,i;if(null!=(t=t.i)&&null!=t.c){for(t.o=t.c.base=null,n=0;n<t.n.length;n++)if(null!=(i=t.n[n])&&null!=i.o){t.o=t.c.base=i.o;break}return a(t)}}function e(t){(!t.f&&(t.f=!0)&&1===s.push(t)||i!==m.debounceRendering)&&(i=m.debounceRendering,(m.debounceRendering||n)(u))}function u(){var t,n,i,r,e,u,o,l;for(s.sort(function(t,n){return n.d.e-t.d.e});t=s.pop();)t.f&&(r=i=void 0,u=(e=(n=t).d).o,o=n.p,l=n.u,n.u=!1,o&&(i=[],r=k(o,e,M({},e),n.w,void 0!==o.ownerSVGElement,null,i,l,null==u?w(e):u),d(i,e),r!=u&&a(e)))}function S(n,i,t,r,e,u,o,l,s){var c,a,f,h,v,d,g,b=t&&t.n||j,p=b.length;if(l==x&&(l=null!=u?u[0]:p?w(t,0):null),c=0,i.n=A(i.n,function(t){if(null!=t){if(t.i=i,t.e=i.e+1,null===(f=b[c])||f&&t.key==f.key&&t.type===f.type)b[c]=void 0;else for(a=0;a<p;a++){if((f=b[a])&&t.key==f.key&&t.type===f.type){b[a]=void 0;break}f=null}if(h=k(n,t,f=f||x,r,e,u,o,null,l,s),(a=t.ref)&&f.ref!=a&&(g=g||[]).push(a,t.c||h,t),null!=h){if(null==d&&(d=h),null!=t.l)h=t.l,t.l=null;else if(u==f||h!=l||null==h.parentNode){t:if(null==l||l.parentNode!==n)n.appendChild(h);"
Expand Down Expand Up @@ -202,7 +207,7 @@ void startConfigPortal() {
return;
}

if (millis() > lastTest + 100) {
if (millis() - lastTest > 100) {
int splitTime[] = {

#ifndef CLOCK_VERSION_IV22
Expand Down Expand Up @@ -598,7 +603,7 @@ void handleRoot() {
html += ">&nbsp;Enable brightness balancing</label></div>";

html += "<div id=\"bal_wrapper\">"; // Toggle wrapper start
html += "<p>When buying used tubes, some are more severely burned out than others. Use options below to lower brightness of the good tubes to match the burned-out ones.</p>";
html += "<p>When buying used tubes, some are more severely burned out than others. Use options below to lower brightness of the good tubes to match the burned-out ones.<br>NOTE: When brightness balancing is enabled, Medium brightness will use High brightness values.</p>";


html += "<h3>Values for high brightness setting:</h3>";
Expand Down
30 changes: 29 additions & 1 deletion Firmware/FLORA_FIRMWARE/neopixel_fns.ino
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void initRgbColon() {
json["rgb"]["v"][1].as<float>() / 100,
json["rgb"]["v"][2].as<float>() / 100,
};

// Lets update all colors according to set brightness!
for (int i = 0; i < 3; i++) {
colonColorDefault[i] = HsbColor(hue, sat, val[i]); // LOW
Expand Down Expand Up @@ -71,18 +71,43 @@ void initRgbColon() {
void updateColonColor(RgbColor color) {
RgbColor colorHigh = color;
RgbColor colorMed = color;
RgbColor colorMedLow = color;
RgbColor colorLow = color;

if (json["colon"].as<int>() == 3) {
#ifdef CLOCK_VERSION_IV12
colorMed = RgbColor::LinearBlend(color, RgbColor(0, 0, 0), 0.2);
colorMedLow = RgbColor::LinearBlend(color, RgbColor(0, 0, 0), 0.5);
colorLow = RgbColor::LinearBlend(color, RgbColor(0, 0, 0), 0.8);
#else
colorMed = RgbColor::LinearBlend(color, RgbColor(0, 0, 0), 0.5);
colorLow = RgbColor::LinearBlend(color, RgbColor(0, 0, 0), 0.7);
#endif
}

// Gamma correction => linearize brightness
colorHigh = colorGamma.Correct(colorHigh);
colorMed = colorGamma.Correct(colorMed);
colorMedLow = colorGamma.Correct(colorMedLow);
colorLow = colorGamma.Correct(colorLow);

#ifdef CLOCK_VERSION_IV12
strip.SetPixelColor(3, colorHigh);
strip.SetPixelColor(2, colorMed);
strip.SetPixelColor(4, colorMed);
strip.SetPixelColor(1, colorMedLow);
strip.SetPixelColor(5, colorMedLow);
strip.SetPixelColor(0, colorLow);
strip.SetPixelColor(6, colorLow);

strip.SetPixelColor(10, colorHigh);
strip.SetPixelColor(9, colorMed);
strip.SetPixelColor(11, colorMed);
strip.SetPixelColor(8, colorMedLow);
strip.SetPixelColor(12, colorMedLow);
strip.SetPixelColor(7, colorLow);
strip.SetPixelColor(13, colorLow);
#else
strip.SetPixelColor(2, colorHigh);
strip.SetPixelColor(3, colorHigh);
strip.SetPixelColor(1, colorMed);
Expand All @@ -96,6 +121,9 @@ void updateColonColor(RgbColor color) {
strip.SetPixelColor(10, colorMed);
strip.SetPixelColor(6, colorLow);
strip.SetPixelColor(11, colorLow);
#endif


}

void handleColon() {
Expand Down

0 comments on commit 80c87cc

Please sign in to comment.