mirror of
				https://github.com/eclipse/upm.git
				synced 2025-10-30 22:54:44 +03:00 
			
		
		
		
	Fix some issues for string based constructors
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:
		 Adelin Dobre
					Adelin Dobre
				
			
				
					committed by
					
						 Mihai Tudor Panu
						Mihai Tudor Panu
					
				
			
			
				
	
			
			
			 Mihai Tudor Panu
						Mihai Tudor Panu
					
				
			
						parent
						
							8f11061de3
						
					
				
				
					commit
					2975bae075
				
			| @@ -106,17 +106,17 @@ adafruitss::adafruitss(std::string initStr) : mraaIo(initStr) | ||||
|  | ||||
|   for(std::string tok : upmTokens) | ||||
|   { | ||||
|     if(tok.substr(0,8) == "pwmFreq:") | ||||
|     if(tok.substr(0, 8) == "pwmFreq:") | ||||
|     { | ||||
|       float freq = std::stof(tok.substr(8)); | ||||
|       setPWMFreq(freq); | ||||
|     } | ||||
|     if(tok.substr(0,6) == "servo:") | ||||
|     if(tok.substr(0, 6) == "servo:") | ||||
|     { | ||||
|       uint8_t port = std::stoi(tok.substr(6),&sz,0); | ||||
|       uint8_t port = std::stoi(tok.substr(6), &sz, 0); | ||||
|       tok = tok.substr(6); | ||||
|       old_sz = sz+1; | ||||
|       uint8_t servo_type = std::stoi(tok.substr(old_sz),&sz,0); | ||||
|       uint8_t servo_type = std::stoi(tok.substr(old_sz), &sz, 0); | ||||
|       tok = tok.substr(old_sz); | ||||
|       float degrees = std::stof(tok.substr(sz+1)); | ||||
|       servo(port, servo_type, degrees); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user