succd: Fix -KEC1 relay board updates
The accesses to -KEC1 always time out on the attempt to update the output values. We noticed that this is related to the timing between the reading of the inputs and the following write to the outputs. Fix -KEC1 accesses by waiting before sending the next request to the board after receiving the reply for the previous one.
This commit is contained in:
		
							parent
							
								
									6f93b96c39
								
							
						
					
					
						commit
						152290f5a3
					
				
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -101,6 +101,11 @@ func (d *daemon) modbusUpdate() {
 | 
			
		|||
		// TODO: Input mapping goes here
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// We must wait between reading and writing to the -KEC1 relay board
 | 
			
		||||
	// because otherwise it chokes and times out the write registers
 | 
			
		||||
	// command.
 | 
			
		||||
	time.Sleep(time.Millisecond * 10)
 | 
			
		||||
 | 
			
		||||
	// KFA1-KFA8
 | 
			
		||||
	var relayState [8]bool
 | 
			
		||||
	d.mu.Lock()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue