/* Function: Measures actual radiation value during 10 seconds. Returns: radiationValue: Returns value of radiation in uSv/H Parameters: Values: */ float WaspRadiationBoard::getRadiationInt() { unsigned long timeRepeat= 10000; unsigned long previous=millis(); enableInterrupts(RAD_INT); while( (millis()-previous<timeRepeat) ) { if( intFlag & RAD_INT){ disableInterrupts(RAD_INT); intFlag &= ~(RAD_INT); countPulse(); while(!digitalRead(RAD_INT_PIN_MON)); enableInterrupts(RAD_INT); } // Condition to avoid an overflow (DO NOT REMOVE) if( millis() < previous ) previous = millis(); } radiationValue = 6.0 *count * CONV_FACTOR; timePreviousMeassure = millis(); ledBar(6*count); count = 0; return radiationValue; }
/* Function: Measures actual radiation value during specified time. Maximum time is 60 seconds Returns: RadiationValueCPM: radiation value in CPM Parameters: time: time while radiation is measured. Time must be in milliseconds Values: */ float WaspRadiationBoard::getCPM(long time) { float k=0; float minute = 60000; unsigned long previous=millis(); enableInterrupts(RAD_INT); while( (millis()-previous<time) ) { if( intFlag & RAD_INT) { disableInterrupts(RAD_INT); intFlag &= ~(RAD_INT); countPulse(); while(!digitalRead(RAD_INT_PIN_MON)); enableInterrupts(RAD_INT); } // Condition to avoid an overflow (DO NOT REMOVE) if( millis() < previous ) previous=millis(); } k = (minute/time); radiationValueCPM = k*count ; timePreviousMeassure = millis(); ledBar(k*count); count = 0; return radiationValueCPM; }
/* Function: Measures actual radiation value during specified time. Maximum measure time is 60 seconds Returns: radiationValue: Returns value of radiation in uSv/H Parameters: time: time while radiation is measured. Time units must be milliseconds Values: */ float WaspSensorRadiation::getRadiation(long time){ float k=0; //used to obtain CPM float minute = 60000; long previous=millis(); while( (millis()-previous<time) ) { if( intFlag & RAD_INT){ disableInterrupts(RAD_INT); intFlag &= ~(RAD_INT); countPulse(); while(!digitalRead(RAD_INT_PIN_MON)); enableInterrupts(RAD_INT); } // Condition to avoid an overflow (DO NOT REMOVE) if( millis()-previous < 0 ) previous=millis(); } k = (minute/time); radiationValueCPM = k*count; radiationValue = k*count * CONV_FACTOR; timePreviousMeassure = millis(); ledBar(k*count); count = 0; return radiationValue; }