   int ddelta;
   float adelta;
 
+  adReadCnt++;
   for (int analogChannel = 0; analogChannel < cnt; analogChannel++) {
     digital= analogRead(ad[analogChannel].port);
     ad[analogChannel].measured.digital += digital;
   }
+  if (adReadCnt==AD_SAMPLECNT)
+    return 1;
   return 0;
 }
 

      break;
    }
  }
  ret = (adder + start->target) - ((v - start->source) / (stop->source - start->source) * (start->target - stop->target));
  return ret;
}

      case METHOD_TABLE:
	iTable=(struct convert *) conditions[i].target;
	conditions[i].limit2->value=resolveConversion(value,conditions[i].limit->value,iTable);
	float radReq=conditions[i].limit2->value;
	float radiator=adArr[3].measured.analog;
	float diff=radReq-radiator;

	if (radiator==-273) // in startup this is -273 = 0 kelvin.
	  return;

	Serial.print("requested radiator temp is ");
	Serial.print(radReq);
	Serial.print(" diff is ");
	Serial.println(diff);
	long turntime=abs(diff) * 1000;
        if (turntime > 10000)
	  turntime=10000;
	else if (turntime < 800)
	  turntime=800;
	if (diff > 0.3) {
          sched.oscillate(30,turntime,LOW,1);
	}
	else if (diff < -0.3) {
          sched.oscillate(31,turntime,LOW,1);
	}
        else {
	  conditions[i].source->flags &= ~FLAGS_EVALUATE;
	}
	break;
      }
    }
  }
}


