+ /*
+ * Set Triac to match temperature
+ */
+ if(run) {
+ if(tempk - 273 < cur) {
+ tron = 1;
+ if(cur - (tempk - 273) > 5) {
+ /* For some reason, the Triac currently doesn't
+ * trigger on one of the AC half-cycles below 0.7
+ * ms. */
+ trdelay = 7;
+ } else if(cur - (tempk - 273) >= 3) {
+ trdelay = 20;
+ } else if(cur - (tempk - 273) >= 2) {
+ trdelay = 40;
+ } else {
+ trdelay = 70;
+ }
+ } else {
+ tron = 0;
+ }
+ } else {
+ tron = 0;
+ }