 uint8_t minRGBLevel = computeMinRGBLevel(targetColor);
 uint16_t totalDimmerSteps = minRGBLevel * NUM_LED;
 
-void setColorForSunSet()
+void setColorForSunset()
 {
   for (uint8_t i = 0 ; i < 3 ; ++i)
   {
-    targetColor[i] = (sunSetDimLevel*1.0/100.0)*(1.0*candleLight[i]);
+    targetColor[i] = (sunsetDimLevel*1.0/100.0)*(1.0*candleLight[i]);
   }
   minRGBLevel = computeMinRGBLevel(targetColor);
   totalDimmerSteps = minRGBLevel * NUM_LED;

  changeState_setAlarm_to_Clock();
}

void changeState_Clock_to_setSunset()
{
  setColorForSunSet();
  matrix.print(sunSetDimLevel);
  if (sunSetDimLevel == 0) {
    matrix.writeDigitNum(4, 0);
  }
  matrix.writeDisplay();
  sunSetActive = true;
  turnLightOn();
  waitForButtonDepress(RotaryButton, LOW);
}

void changeState_setSunset_to_Clock()
{
  if (sunSetDimLevel == 0) {
    sunSetActive = false;
    turnLightOff();
  }
  writeSunSetDimToEEPROM();
}

uint32_t millisAtStartOfSunSet = 0;
bool sunSetActive = false;
void setSunSetState() {
  changeState_Clock_to_setSunset();
  
  uint32_t modeActive = millis();

  return lastResult;
}

bool alarmButtonPushed()
{
  return (digitalRead(AlarmButton) == LOW && debounceDigitalRead(AlarmButton) == LOW);
}

bool timeButtonPushed()
{
  return (digitalRead(TimeButton) == LOW && debounceDigitalRead(TimeButton) == LOW);
}
bool offButtonPushed()
{
  return (digitalRead(OffButton) == HIGH && debounceDigitalRead(OffButton) == HIGH);
}

bool rotaryButtonPushed()
{
  return (digitalRead(RotaryButton) == LOW && debounceDigitalRead(RotaryButton) == LOW);
}

bool readAlarmTimeFromEEPROM() {
  if (eeprom.isPresent()) {
    char buf[2];
    eeprom.ReadMem(alarm_address, buf, 2);
    alarmTime.hour = static_cast<int>(buf[0]);
    alarmTime.minute = static_cast<int>(buf[1]);
    return true;
  }
  return false;
}

bool writeAlarmTimeToEEPROM() {
  if (eeprom.isPresent()) {
    char myBuf[2];
    myBuf[0] = static_cast<char>(alarmTime.hour);
    myBuf[1] = static_cast<char>(alarmTime.minute);
    eeprom.WriteMem(alarm_address, myBuf, 2);
    return true;
  }
  return false;
}

bool readBrightnessFromEEPROM() {
  if (eeprom.isPresent()) {
    char buf[1];
    eeprom.ReadMem(brightness_address, buf, 1);
    matrixBrightness = static_cast<int>(buf[0]);
    return true;
  }
  return false;
}

bool writeBrightnessToEEPROM() {
  if (eeprom.isPresent()) {
    char myBuf[1];
    myBuf[0] = static_cast<char>(matrixBrightness);
    eeprom.WriteMem(brightness_address, myBuf, 1);
    return true;
  }
  return false;
}


bool readSunsetDeltaFromEEPROM() {
  if (eeprom.isPresent()) {
    char buf[1];
    eeprom.ReadMem(sunset_address, buf, 1);
    defaultSunsetDelta = static_cast<int>(buf[0]);
    return true;
  }
  return false;
}

bool writeSunsetDeltaToEEPROM() {
  if (eeprom.isPresent()) {
    char myBuf[1];
    myBuf[0] = static_cast<char>(defaultSunsetDelta);
    eeprom.WriteMem(sunset_address, myBuf, 1);
    return true;
  }
  return false;
}

bool readSunsetDimFromEEPROM() {
  if (eeprom.isPresent()) {
    char buf[1];
    eeprom.ReadMem(sunset_dim_address, buf, 1);
    sunsetDimLevel = static_cast<int>(buf[0]);
    return true;
  }
  return false;
}

bool writeSunsetDimToEEPROM() {
  if (eeprom.isPresent()) {
    char myBuf[1];
    myBuf[0] = static_cast<char>(sunsetDimLevel);
    eeprom.WriteMem(sunset_dim_address, myBuf, 1);
    return true;
  }
  return false;
}




uint8_t computeMinRGBLevel(uint8_t* RGB)
{
  uint8_t myRGB[3] = {255, 255, 255};
