Previously good code not compiling

I got a real head bonker… what am I missing this code compiled earlier and is running fine. Now there are endless errors.

/*For sonoff use generic 8266
 * set flash to 1m (0 SPIFFS)
 * DOUT
 * 9e82e1 label
 * gp12 relay
 * gp5  relay
 * gp13 blue led
 * gp10 on board button
 */

#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <WidgetRTC.h>
#include <TimeLib.h>

char auth[] = "*****";
char ssid[] = "***********";
char pass[] = "**********";

BlynkTimer timer;
WidgetLCD lcd (V0);
const int interruptPin = 10;  //GPIO pin 10
int ReCnctCount;
int ReCnctFlag;
long resetTime;
int SThour;
int STmin;
int litersReset = 0;
bool d1Trig = false; //Bool to store interupt for D1
bool d2Trig = false; //Bool to store interupt for D2
int counterLiters;
WidgetLED trig1LED (V5);
WidgetLED trig2LED (V6);

WidgetRTC rtc;

void setup(){
  WiFi.begin(ssid,pass);
  Blynk.config(auth);
  Blynk.connect();
  ArduinoOTA.setHostname("waterMeter1");
  ArduinoOTA.begin();

These timer.setIntervals are throwing errors says “checkcounterReset not declared in this scope”

  timer.setInterval(1000L,checkcounterReset);
  delay(50);
  timer.setInterval(1000L,WiFistrength);
  delay(75);
  timer.setInterval(1000L,printTIME);
  lcd.print(0,0, "Sonoff started");
  pinMode(interruptPin, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(interruptPin),counterAdd,RISING);
  pinMode(0, INPUT_PULLUP);
  pinMode(9, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(0), d1Trigopp, FALLING);
  attachInterrupt(digitalPinToInterrupt(9), d2Trigopp, FALLING);
  Blynk.virtualWrite(V4,counterLiters);
  delay(500); 
  lcd.clear();
  Blynk.syncAll();
  setSyncInterval(720*60);
}

BLYNK_CONNECTED(){
  Serial.println("Connected");
  ReCnctCount = 0;
  rtc.begin();
}

void loop(){
  timer.run();
  ArduinoOTA.handle(); 

if (Blynk.connected()){                                             //If Blynk connected run as normal
    Blynk.run();
}
else if (ReCnctFlag == 0){                                          //test connection flag
    ReCnctFlag = 1;                                                 //set connection flag
    timer.setTimeout(30000L,[](){                                   //Lambda "Reconnection" timer function
      ReCnctFlag = 0;
      ReCnctCount++;                                                //count up reconnection attempts
      Blynk.connect();                                              //try to connect again
    });
}
}

/* water meter add */
void d1Trigopp()
{
  d1Trig = true; //On interupt set D1 bool to true 
  lcd.print(0,1, counterLiters);
  trig1LED.on();
  trig2LED.off(); 
  Blynk.virtualWrite(V2, 2); 
}

void d2Trigopp()
{
  d2Trig = true;                                 //On interupt set set D2 bool to true
  if(d1Trig == true && d2Trig == true)           //Check both variables
    {
    counterLiters ++;                            //increment counter
    lcd.print(0,1, counterLiters);
    Blynk.virtualWrite(V4,counterLiters);        //print counter
    d1Trig = false;                              //immediately set values to false so exits loop
    d2Trig = false;
    trig1LED.off();                              //virtualLEDs to show which one triggered last
    trig2LED.on();
    }
}

void WiFistrength()                              //prints wifi strength
{
  long rssi = WiFi.RSSI();           
  //lcd.clear();
  lcd.print(4,0, rssi);
  Blynk.virtualWrite(V21,rssi);
}

void checkcounterReset()                         //time input
{
 if(hour()== SThour){                            //daily output total liters to super chart 1 minute before clearing
    if(minute()== (STmin +1)){
      Blynk.virtualWrite(V15,counterLiters);
    }
 if(hour() == SThour){                           //daily clear total liters
  if(minute() == STmin){
    if(litersReset == 0){
      counterLiters = 0;
      lcd.print(0,1, counterLiters);
      Blynk.virtualWrite(V4,counterLiters);
      litersReset = 1;                           //change flag so only exicute once
      lcd.print(3,1,litersReset); 
      lcd.print(4,1,"           ");
    }
  }
 }
 if(hour()== SThour){                            //change flag so that counter can be reset next day
    if(minute()== (STmin +1)){
      litersReset = 0;
      lcd.print(3,1, litersReset);
    }
  }
}

These BLYNK_WRITE functions don’t compile “a function-definition is not allowed here before ‘{’ token”

BLYNK_WRITE(V1)
{
    counterLiters = 0;                            //manual reset
    lcd.print(0,1, counterLiters);
}

BLYNK_WRITE(V16)
{
  if (param.asInt()){                             //manual reset esp if needed
    lcd.print(8,0, "ESPReset");
    timer.setTimeout(5000L,resetESP);
  }
}

void resetESP()
{
  ESP.reset();
}

BLYNK_WRITE(V10)
{
  TimeInputParam t(param);                        //time input
  SThour = t.getStartHour();
  STmin = t.getStartMinute();
  
  lcd.print(3,1,(String("Strt ") +
               t.getStartHour() + ":" +
               t.getStartMinute() + ":" +
               t.getStartSecond()));
}

BLYNK_WRITE(V13)
{
  if(param.asInt()){                             //manual uptick for testing
  counterLiters ++;
  lcd.print(0,1, counterLiters);
}
}

And these void functions cause errors!!

void printTIME()                                //what it says!
{
  String currentTime = String(hour())+ ":" +minute()+ ":" +second();
  Blynk.virtualWrite(V14, currentTime);
}

:face_with_thermometer:
:angry:
Its got to be something simple but I can’t find it.
:crazy_face:

Everytime I comment 1 thing out there is another error.

Does this compile for anyone else?

HAHA! it was something easy missing curly at the end of the void checkcounterReset() function. Thought I had checked them all. Head ache must be getting me.

I spotted that, but was having other problems because there’s an interrupt call to a function called void counterAdd() that didn’t seem to be in your code.

Probably easier to simply dump the whole code in one block in future rather than chopping it up, it makes it difficult to reassemble it to try compiling.

Anyway, glad you fixed it.

Pete.