user63039: As the title says i'm having a problem with an if clause evaluating incorrectly in one particular function 
uint16_t    getSleepTime()
{
    volatile uint8_t flag = EEPROM.read(3);

    uint8_t high    = EEPROM.read(0);
    uint8_t low     = EEPROM.read(1);

    if(flag != 0xaa);
    {
        Serial.println(flag);
        Serial.println("ERROR: SLEEP TIME NOT DEFINED, CANNOT CONTINUE.");
        while(true)
        {
            digitalWrite(PIN_LED, true);
            delay(250);
            digitalWrite(PIN_LED, false);
            delay(250);
            wdt_reset();
        }
    }

    return word(high, low);
}

the result is that the if function evaluates as true always
my first thought was, ok the eeprom wasn't written properly, hence i added the println, the returned value was 170 == 0xaa
then i thought well maybe the flag variable is optimized out, hence the volatile
and then, well maybe its a type comparison issue so i also defined a const uint8_t flagv with value 0xaa
same results in every case
13:21:00.991 -> 170
13:21:00.991 -> ERROR: SLEEP TIME NOT DEFINED, CANNOT CONTINUE.
and the corresponding blink

the thing is that being such a trivial code i'm out of ideas right now, as anyone here experienced something like this?

user31105: Do not put a ; after an if:
if(flag != 0xaa);

is the same as
if(flag != 0xaa)
{
}

Meaning that the code after the if statement is always executed.

63039: <p>As the title says i'm having a problem with an if clause evaluating incorrectly in one particular function </p>

<pre><code>uint16_t    getSleepTime()
{
    volatile uint8_t flag = EEPROM.read(3);

    uint8_t high    = EEPROM.read(0);
    uint8_t low     = EEPROM.read(1);

    if(flag != 0xaa);
    {
        Serial.println(flag);
        Serial.println("ERROR: SLEEP TIME NOT DEFINED, CANNOT CONTINUE.");
        while(true)
        {
            digitalWrite(PIN_LED, true);
            delay(250);
            digitalWrite(PIN_LED, false);
            delay(250);
            wdt_reset();
        }
    }

    return word(high, low);
}
</code></pre>

<p>the result is that the if function evaluates as true always
my first thought was, ok the eeprom wasn't written properly, hence i added the println, the returned value was 170 == 0xaa
then i thought well maybe the flag variable is optimized out, hence the volatile
and then, well maybe its a type comparison issue so i also defined a const uint8_t flagv with value 0xaa
same results in every case</p>

<pre><code>13:21:00.991 -&gt; 170
13:21:00.991 -&gt; ERROR: SLEEP TIME NOT DEFINED, CANNOT CONTINUE.
and the corresponding blink
</code></pre>

<p>the thing is that being such a trivial code i'm out of ideas right now, as anyone here experienced something like this?</p>
 31105: <p>Do not put a <code>;</code> after an if:</p>

<pre><code>if(flag != 0xaa);
</code></pre>

<p>is the same as</p>

<pre><code>if(flag != 0xaa)
{
}
</code></pre>

<p>Meaning that the code after the <code>if</code> statement is always executed.</p>
