t0mg/wordclock

Network box

Closed this issue · 10 comments

Is it possible to hide the network box or to collapse it if the network is already set up? or at least place it at the bottom.

t0mg commented

Yes, good idea. I'll look into it.

And sometimes when I apply changes they don't update on the leds, like changing colors, I have to press the boot button on the ESP then it applies.
And another thing is I've made the Italian clockface wich doesn't have the AMPM indicator, so would be cool that if a clockface doesn't have AMPM the setting shouldn't appear.
My Italian Clockface

// Constants to match the ItalianClockFace.
//
// Letters in lowercase below are not used by the clock.

//SONOrLEbORE
//ÈrLUNAsDUEz
//TREOTTONOVE
//DIECIUNDICI
//DODICISETTE
//QUATTROcSEI
//CINQUEaMENO
//EcUNoQUARTO
//VENTICINQUE
//DIECIpMEZZA

// All the segments of words on the board. The first too numbers are the
// coordinate of the first letter of the word, the last is the length. A word
// must always be on one row.


#define IT_S_SONO 0, 0, 4
#define IT_S_LE 5, 0, 2
#define IT_S_E 0, 1, 1
#define IT_S_ORE 8, 0, 3

#define IT_H_LUNA 2, 1, 4
#define IT_H_DUE 7, 1, 3
#define IT_H_TRE 0, 2, 3
#define IT_H_QUATTRO 0, 5, 7
#define IT_H_CINQUE 0, 6, 6
#define IT_H_SEI 8, 5, 3
#define IT_H_SETTE 6, 4, 5
#define IT_H_OTTO 3, 2, 4
#define IT_H_NOVE 7, 2, 4
#define IT_H_DIECI 0, 3, 5
#define IT_H_UNDICI 5, 3, 6
#define IT_H_DODICI 0, 4, 6

#define IT_M_E 0, 7, 1
#define IT_M_MENO 7, 6, 4
#define IT_M_DIECI 0, 9, 5
#define IT_M_UN 2, 7, 2
#define IT_M_QUARTO 5, 7, 6
#define IT_M_VENTI 0, 8, 5
#define IT_M_CINQUE 5, 8, 6
#define IT_M_MEZZA 6, 9, 5



bool ItalianClockFace::stateForTime(int hour, int minute, int second, bool show_ampm)
{
  if (hour == _hour && minute == _minute)
  {
    return false;
  }
  _hour = hour;
  _minute = minute;

  DLOGLN("update state");

  // Reset the board to all black
  for (int i = 0; i < NEOPIXEL_COUNT; i++)
    _state[i] = false;

  int leftover = minute % 5;
  minute = minute - leftover;

  if (minute >= 35)
    hour = (hour + 1) % 24; // Switch to "TO" minutes the next hour

  // Special case for one o'clock
  if (hour == 1 || hour == 13)
  {
    updateSegment(IT_S_E);
    updateSegment(IT_H_LUNA);
  }
  else // Normal case for other hours
  {
    updateSegment(IT_S_SONO);
    updateSegment(IT_S_LE);
    switch (hour)
    {
    case 0:
      updateSegment(IT_H_DODICI);
      break;
    case 2:
    case 14:
      updateSegment(IT_H_DUE);
      break;
    case 3:
    case 15:
      updateSegment(IT_H_TRE);
      break;
    case 4:
    case 16:
      updateSegment(IT_H_QUATTRO);
      break;
    case 5:
    case 17:
      updateSegment(IT_H_CINQUE);
      break;
    case 6:
    case 18:
      updateSegment(IT_H_SEI);
      break;
    case 7:
    case 19:
      updateSegment(IT_H_SETTE);
      break;
    case 8:
    case 20:
      updateSegment(IT_H_OTTO);
      break;
    case 9:
    case 21:
      updateSegment(IT_H_NOVE);
      break;
    case 10:
    case 22:
      updateSegment(IT_H_DIECI);
      break;
    case 11:
    case 23:
      updateSegment(IT_H_UNDICI);
      break;
    case 12:
      updateSegment(IT_H_DODICI);
      break;
    default:
      DLOG("Invalid hour ");
      DLOGLN(hour);
    }
  }

switch (minute)
{
case 0:
  // Check if the hour value is 1 or 13
  if (hour != 1 && hour != 13)
  {
    // If not, display "ORE"
    updateSegment(IT_S_ORE);
  }
  break;
// The rest of the switch statement

  case 5:
    updateSegment(IT_M_E);
    updateSegment(IT_M_CINQUE);
    break;
  case 10:
    updateSegment(IT_M_E);
    updateSegment(IT_M_DIECI);
    break;
  case 15:
    updateSegment(IT_M_E);
    updateSegment(IT_M_UN);
    updateSegment(IT_M_QUARTO);
    break;
  case 20:
    updateSegment(IT_M_E);
    updateSegment(IT_M_VENTI);
    break;
  case 25:
    updateSegment(IT_M_E);
    updateSegment(IT_M_VENTI);
    updateSegment(IT_M_CINQUE);
    break;
  case 30:
    updateSegment(IT_M_E);
    updateSegment(IT_M_MEZZA);
    break;
  case 35:
    updateSegment(IT_M_MENO);
    updateSegment(IT_M_VENTI);
    updateSegment(IT_M_CINQUE);
    break;
  case 40:
    updateSegment(IT_M_MENO);
    updateSegment(IT_M_VENTI);
    break;
  case 45:
    updateSegment(IT_M_MENO);
    updateSegment(IT_M_UN);
    updateSegment(IT_M_QUARTO);
    break;
  case 50:
    updateSegment(IT_M_MENO);
    updateSegment(IT_M_DIECI);
    break;
  case 55:
    updateSegment(IT_M_MENO);
    updateSegment(IT_M_CINQUE);
    break;
  default:
    DLOG("Invalid minute ");
    DLOGLN(minute);
  }

  switch (leftover)
  {
  case 4:
    _state[mapMinute(TopLeft)] = true;
  case 3: // fall through
    _state[mapMinute(BottomLeft)] = true;
  case 2: // fall through
    _state[mapMinute(BottomRight)] = true;
  case 1: // fall through
    _state[mapMinute(TopRight)] = true;
  case 0: // fall through
    break;
  }
  return true;
}
t0mg commented

Thanks ! your Italian clock face was just added to the repository with PR #27

Regarding updates not working, there was a timer bug that was just fixed yesterday that could have caused this, but if you are still able to reproduce it would be helpful to see if there's any info on the serial console.

As for AMPM it's the same with French actually (unused too), I need to think of a simple way to toggle that.

Can I reach out to you somehow? I have issues with the new code. If you can, text me at @IlGiurgi on telegram.

t0mg commented

Sorry I'm not in telegram. Feel free to file as many issues as necessary here! It might help others.

For some reason I messed up something maybe with the cables or something but the ESP keeps rebooting with the code, I tried uploading a code to see if each component works well and they do, so I can't figure out what's the reason of the reboots.. That's the error, I always used same usb cables ecc so it could be the board maybe?
12:51:36.869 ->
12:51:36.869 -> Brownout detector was triggered
12:51:36.869 ->
12:51:36.869 -> ets Jul 29 2019 12:21:46
12:51:36.869 ->
12:51:36.869 -> rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
12:51:36.869 -> configsip: 0, SPIWP:0xee
12:51:36.869 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
12:51:36.869 -> mode:DIO, clock div:1
12:51:36.869 -> load:0x3fff0030,len:1344
12:51:36.869 -> load:0x40078000,len:13964
12:51:36.869 -> load:0x40080400,len:3600
12:51:36.869 -> entry 0x400805f0

t0mg commented

Uh oh Brownout detector was triggered ?

Is the power supply too weak?

No it's the right one, but it worked before with everything running smooth even from the usb to pc cable, I might have changed some cables out maybe but every component is working well, I will try setting everything up on another ESP...

t0mg commented

Ok thanks for the heads up I will also do some testing

t0mg commented

As of 1d2bcd9 there is now a language selector (including italian) and we hide the am/pm if unused. We also move the network section to the bottom after initial setup.

I've tested the firmware on my clock and it works without issue, so I'll close this ticket (which was about the network section of the web UI) but feel free to open another if your issues persist!