You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • I've only had time for a quick glance, but it looks good to me.

    Only things I'd say are:

    • As a style thing, in the Espruino code I tend to have variables starting with a lowercase letter, and classes starting with uppercase.. So tempHistory instead of TempHistory - but that's purely personal style :)
    • You might want to put your initialisation code in an onInit function - when you get around to saving your code into flash, that function will then get called at power-on.
    • Where you do setInterval( function() { ... }, 60000); it might be easier to do function onMinute() { ... }; setInterval(onMinute, 60000);. It means that you can then use the left-hand side of the Web IDE to modify the onMinute function while your code is running - it's handy for debugging, especially in a system like this where it'll take a few minutes for the PID system to get happy (so you're unlikely to want to reset too often!).

    With the whole PID thing, I'd really like to come up with a PID library for Espruino that had some kind of self-calibrating functionality. Getting the correct values seems like magic to me!


Avatar for Gordon @Gordon started