The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

The New Hotness

  • C Constants Aren’t Automatically Promoted

    Quick, what’s wrong with this code snippet…

    #define MAX_INTERVAL	(60*1000)
    
    unsigned long int LoggedTime;
    unsigned long int NowTime;
    
    byte LogNeeded;
    
    ... snippage ...
    
    LogNeeded = (NowTime >= (LoggedTime + MAX_INTERVAL)); 
    

    Yeah, that constant up there should look like this:

    #define MAX_INTERVAL (60*1000ul)

    Took me a while to figure that out. Again.