mirror of
				https://github.com/miguel5612/MQSensorsLib.git
				synced 2025-11-04 09:06:01 +03:00 
			
		
		
		
	Update MQUnifiedsensor.cpp
Change the `_type` array size from 6 to 7 so that it can display sensor name's with 6 characters or more.
This commit is contained in:
		@@ -3,7 +3,7 @@
 | 
				
			|||||||
MQUnifiedsensor::MQUnifiedsensor(String Placa, float Voltage_Resolution, int ADC_Bit_Resolution, int pin, String type) {
 | 
					MQUnifiedsensor::MQUnifiedsensor(String Placa, float Voltage_Resolution, int ADC_Bit_Resolution, int pin, String type) {
 | 
				
			||||||
  this->_pin = pin;
 | 
					  this->_pin = pin;
 | 
				
			||||||
  Placa.toCharArray(this->_placa, 20);
 | 
					  Placa.toCharArray(this->_placa, 20);
 | 
				
			||||||
  type.toCharArray(this->_type, 6);
 | 
					  type.toCharArray(this->_type, 7);
 | 
				
			||||||
  //this->_type = type; //MQ-2, MQ-3 ... MQ-309A
 | 
					  //this->_type = type; //MQ-2, MQ-3 ... MQ-309A
 | 
				
			||||||
  //this->_placa = Placa;
 | 
					  //this->_placa = Placa;
 | 
				
			||||||
  this-> _VOLT_RESOLUTION = Voltage_Resolution;
 | 
					  this-> _VOLT_RESOLUTION = Voltage_Resolution;
 | 
				
			||||||
@@ -11,7 +11,7 @@ MQUnifiedsensor::MQUnifiedsensor(String Placa, float Voltage_Resolution, int ADC
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
MQUnifiedsensor::MQUnifiedsensor(String Placa, String type) {
 | 
					MQUnifiedsensor::MQUnifiedsensor(String Placa, String type) {
 | 
				
			||||||
  Placa.toCharArray(this->_placa, 20);
 | 
					  Placa.toCharArray(this->_placa, 20);
 | 
				
			||||||
  type.toCharArray(this->_type, 6);
 | 
					  type.toCharArray(this->_type, 7);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
void MQUnifiedsensor::init()
 | 
					void MQUnifiedsensor::init()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -233,4 +233,4 @@ float MQUnifiedsensor::getRS()
 | 
				
			|||||||
float MQUnifiedsensor::stringTofloat(String & str)
 | 
					float MQUnifiedsensor::stringTofloat(String & str)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return atof( str.c_str() );
 | 
					  return atof( str.c_str() );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user