   if (!alarmActive)
   {
     setColorForSunRise();
-    alarmStartMillis = millis();
+    alarmStartMillis = static_cast<unsigned long>(millis()-1000*seconds);
     alarmActive = true;
   }
   if (seconds >= thirtyminutes) {
     linearBrightOfStep(totalDimmerSteps);
     return;
   }
-  linearBrightOfMilliseconds(millis()-alarmStartMillis);
+  logisticBrightOfMilliseconds(static_cast<unsigned long>(millis()-alarmStartMillis));
 }
 
 

  //pinMode(LEDpinA,OUTPUT); digitalWrite(LEDpinA,0);
  pinMode(AlarmButton,INPUT_PULLUP); 
  pinMode(TimeButton,INPUT_PULLUP);
  pinMode(OffButton,INPUT);
  pinMode(AlarmLED, OUTPUT);
  pinMode(TimeLED, OUTPUT);

}

unsigned long alarmStartMillis = 0;
const unsigned lightUpdateInterval = 50;
unsigned long lastLightUpdate = millis();
void updateLight() {
  if (!isTimeNow(lastLightUpdate,lightUpdateInterval)) {
    return;
  }
  if (digitalRead(AlarmEnabledSwitch) == LOW) return;
  ClockTime current = current_clock_time;
  int32_t seconds = secondsBtwDates(current,startTime);
  if ((seconds < 0) || (seconds >= maxTime)) {
