void value not ignored as it ought to be

Having real issue with this coding folk, have spent a few days on it now and still no luck, any chance someone could have a look over it and see what is going wrong, the piece in question is…

void dual_clock_update(tmElements_t &myte)
      {
      bool result;
      time_t mytt;
      
      slcd3_clear();
      Serial.print("=>set clock?n");
      
      // convert tm element into a time_t
      mytt = makeTime(myte);
      // set the RTC with time_t
      result = RTC.set(mytt);  
      if(!result)
    {
    Serial.print("?y2?x03!!! FAILED !!!");
    slcd3_beep(3);
    delay(9000);
    }
  else
    {
                Serial.print("?y2?x03 - Accepted - ");
                // set the system time to time_t too
                setTime(mytt);
    delay(2000);
    }

      // done
      // clear the LCD
      slcd3_clear();
      }

Seems to be calling the RTC time is the issue… any help at all would be much appreciated.

I have attached the full code and .h if that helps.

Luke

full_tank_control.ino (23.2 KB)

reef_lights.h (2.64 KB)

result = RTC.set(mytt);

that is returning a void value (ie, it doesn't return anything). You're trying to store that in a variable - and then test that variable.

It appears you believe (incorrectly) that RTC.set() returns true on success, false on failure - but it returns nothing.

Is there a quick fix for this or am I back to the drawing board?

lberry88: Is there a quick fix for this or am I back to the drawing board?

Sure, don't try to get a value from a function that won't give you one. Change that line to just call RTC.set and don't try to stuff anything in a variable.

Remove the result = from that line, since the function returns nothing.

Is there a reason you belive that a failure to set the time on the RTC is a realistic error condition?

If so, just read back the value, and make sure it's the same (well very close to the same).

If not, get rid of the test and just assume it succeeded. The fact that the library doesn't have that return anything makes me suspect that it's not a typical error condition (assuming correct wiring)