     if((millis()-startTime) > (timeout*1000)){
       Serial.println("portaltimeout");
       portalRunning = false;
-      if(startCP){
+      if(startAP){
         wm.stopConfigPortal();
       }  
       else{

unsigned int  timeout   = 120; // seconds to run for
unsigned int  startTime = millis();
bool portalRunning      = false;
bool startCP            = false; // start AP and webserver if true, else start only webserver

void setup() {
  // put your setup code here, to run once


  // is configuration portal requested?
  if(digitalRead(TRIGGER_PIN) == LOW && (!portalRunning)) {
    if(startAP){
      Serial.println("Button Pressed, Starting Config Portal");
      wm.setConfigPortalBlocking(false);
      wm.startConfigPortal();
