nathanchantrell/TinyTX

IF ended too early

Closed this issue · 2 comments

Hi Nathan,

I'm still new with github and not sure how to pull to your repo - but I have found a minor error in your/my code (TinyTX_LDR_Meter.ino), which produces an error if less than 1000 (in this case) millis since last blink.

...
    } else if (interval > 1000) { // 1+ sec passed
        // Blinks are 1000 per kWh, or 1 Wh each
        // One hour has 3.6M milliseconds
        watts = nBlinks * 1 * 3.6E6 / interval;

        last = time;
        nBlinks = 0;
    }

  tinytx.power = watts; // Get realtime power

  tinytx.supplyV = readVcc(); // Get supply voltage

  rfwrite(); // Send data via RF    

    }

}

Needs to be changed to:

...
    } else if (interval > 1000) { // 1+ sec passed
        // Blinks are 1000 per kWh, or 1 Wh each
        // One hour has 3.6M milliseconds
        watts = nBlinks * 1 * 3.6E6 / interval;

        last = time;
        nBlinks = 0;

  tinytx.power = watts; // Get realtime power

  tinytx.supplyV = readVcc(); // Get supply voltage

  rfwrite(); // Send data via RF    

      }

    }

}

Kind regards,
Troels

Thanks Troels, I'll update it.

Cheers,
Nathan

On 13 September 2013 18:53, tleegaard notifications@github.com wrote:

Hi Nathan,

I'm still new with github and not sure how to pull to your repo - but I
have found a minor error in your/my code, which produces an error if less
than 1000 (in this case) millis since last blink.

...
} else if (interval > 1000) { // 1+ sec passed
// Blinks are 1000 per kWh, or 1 Wh each
// One hour has 3.6M milliseconds
watts = nBlinks * 1 * 3.6E6 / interval;

    last = time;
    nBlinks = 0;
}

tinytx.power = watts; // Get realtime power

tinytx.supplyV = readVcc(); // Get supply voltage

rfwrite(); // Send data via RF

}

}

Needs to be changed to:

...
} else if (interval > 1000) { // 1+ sec passed
// Blinks are 1000 per kWh, or 1 Wh each
// One hour has 3.6M milliseconds
watts = nBlinks * 1 * 3.6E6 / interval;

    last = time;
    nBlinks = 0;

tinytx.power = watts; // Get realtime power

tinytx.supplyV = readVcc(); // Get supply voltage

rfwrite(); // Send data via RF

  }

}

}

Kind regards,
Troels


Reply to this email directly or view it on GitHubhttps://github.com//issues/3
.

Hi Nathan,
I just found out how to make a pull request (I think) :-)

Cheers!