Compare commits

..

No commits in common. "688b912539cdea9c385e62ec1ff18bb919924e15" and "0927059d4eebab0a5bf5d3a81e781103328c09cd" have entirely different histories.

4 changed files with 13 additions and 27 deletions

View File

@ -15,7 +15,6 @@ _error(OK),
_state(IDLING),
_channel(0),
_courant(0.0),
_tension(0.0),
_triggerLevelOff(false)
{
//Allocation dynamique des différent tableaux
@ -34,6 +33,9 @@ _triggerLevelOff(false)
_rOffsetMap = NULL;
_resistanceMap = NULL;
}
//We start the comm with the adcs
_adc.begin();
}
MeasureUnit::~MeasureUnit()
@ -89,10 +91,6 @@ double *MeasureUnit::getTemperatures()
Serial.print("Debug voltage delta : ");Serial.println(_resistanceMap[i]);
#endif
}
//Ne pas oublier de déduire la chute de tension de la resistance de precision pour la première thermistance
_resistanceMap[0] -= rPrecTension;
Serial.printf("Debug voltage delta : 0 -> ");Serial.println(_resistanceMap[0]);
for(int i(0); i < _thermistorCount; i++)
{
@ -167,16 +165,14 @@ void MeasureUnit::startTemperatureMeasurement()
break;
case MEASURING:
_adc.startSample(_channel);
if(_channel == 0) //Calcule du courant
{
if(_adc.isSampleReady())
{
_tension = _adc.getSampleVoltage();
_courant = _tension / (double) _precResistor;
#ifdef DEBUG
Serial.print("Tension prec : ");Serial.println(_tension);
#endif
double tension = _adc.getSampleVoltage();
_courant = tension / (double) _precResistor;
//Serial.println(tension);
_channel++;
}
}
@ -185,10 +181,8 @@ void MeasureUnit::startTemperatureMeasurement()
if(_adc.isSampleReady())
{
_resistanceMap[_channel-1] = _adc.getSampleVoltage();
#ifdef DEBUG
Serial.print("Tension thermistances : ");Serial.println(_resistanceMap[_channel-1]);
#endif
_channel++;
//Serial.println(_resistanceMap[_channel-1]);
_channel++;
}
}
@ -206,15 +200,9 @@ void MeasureUnit::startTemperatureMeasurement()
//Calcule de delta :
_resistanceMap[i] -= _resistanceMap[i-1];
#ifdef DEBUG
Serial.printf("Debug voltage delta : %u -> ",i);Serial.println(_resistanceMap[i]);
Serial.print("Debug voltage delta : ");Serial.println(_resistanceMap[i]);
#endif
}
//Ne pas oublier de déduire la chute de tension de la resistance de precision pour la première thermistance
_resistanceMap[0] -= _tension;
#ifdef DEBUG
Serial.printf("Debug voltage delta : 0 -> ");Serial.println(_resistanceMap[0]);
#endif
for(int i(0); i < _thermistorCount; i++)
{

View File

@ -11,7 +11,6 @@ class MeasureUnit
enum ERROR {OK = 0, MALLOC_ERR = 1};
MeasureUnit(uint8_t *analogInput, uint16_t thermistorCount, uint64_t precResistor, ThermistorSetting thermistorSetting, Adc &adc);
~MeasureUnit();
void init(){_adc.begin();}
void setGlobalTempOffset(double offset);
void levelTemperaturesOff();
double getGlobalTempOffset();
@ -47,7 +46,7 @@ class MeasureUnit
//Async part
STATE _state;
uint8_t _channel;
double _courant, _tension;
double _courant;
boolean _triggerLevelOff; //Attribut permettant de savoir si un étalonnage a été demandé
};

View File

@ -5,7 +5,6 @@ PayloadFormatter::PayloadFormatter(uint8_t numOfRow, uint8_t numOfColumn) : _tot
_length = numOfRow * numOfColumn * 2 + 7 + 1;
_payload = (uint8_t *) calloc(_length, sizeof(uint8_t));
}
PayloadFormatter::~PayloadFormatter()
{
free(_payload);
@ -25,7 +24,7 @@ boolean PayloadFormatter::endSession()
return ret;
}
int16_t PayloadFormatter::buildPayload(uint8_t **buffer, DateTime *dateTime, double *tempArray, uint8_t numOfRow, uint8_t numOfColumn)
int16_t PayloadFormatter::buildPayload(uint8_t **buffer, DateTime *dateTime, double *tempArray)
{
*buffer = _payload;
if(_currentPayload == _totalPayloads || !_totalPayloads)

View File

@ -9,7 +9,7 @@ class PayloadFormatter
PayloadFormatter(uint8_t numOfRow, uint8_t numOfColumn);
~PayloadFormatter();
int16_t buildPayload(uint8_t **buffer, DateTime *dateTime, double *tempArray, uint8_t numOfRow = -1, uint8_t numOfColumn = -1);
int16_t buildPayload(uint8_t **buffer, DateTime *dateTime, double *tempArray);
void startSession(uint8_t totalPackets);
boolean endSession();