Sorry - was checking on my phone and didn't see that.
Just looked and it seems you are initialising the lcd before you initialise the i2c. Try moving the i2c.setup line above the hd44780 line.
It probably explains why you had to copy all the other lines outside of the onInit function too?
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Sorry - was checking on my phone and didn't see that.
Just looked and it seems you are initialising the lcd before you initialise the i2c. Try moving the i2c.setup line above the hd44780 line.
It probably explains why you had to copy all the other lines outside of the onInit function too?