added docker-compose for linux fixed 3 comport writer
This commit is contained in:
@@ -74,13 +74,16 @@ class ComPortTestWriter:
|
||||
|
||||
def generate_scales_data(self) -> str:
|
||||
"""Generate simulated scales data"""
|
||||
# Simulate scales value fluctuating slightly
|
||||
variation = random.uniform(-0.1, 0.1)
|
||||
self.current_scales_value += variation
|
||||
|
||||
# Keep within bounds
|
||||
# Step through the range and reverse at each end
|
||||
if not hasattr(self, '_direction'):
|
||||
self._direction = 1
|
||||
step = random.uniform(SCALES_INCREMENT * 0.8, SCALES_INCREMENT * 1.2)
|
||||
self.current_scales_value += step * self._direction
|
||||
if self.current_scales_value >= SCALES_MAX:
|
||||
self._direction = -1
|
||||
elif self.current_scales_value <= SCALES_MIN:
|
||||
self._direction = 1
|
||||
self.current_scales_value = max(SCALES_MIN, min(SCALES_MAX, self.current_scales_value))
|
||||
|
||||
return f"{self.current_scales_value:.2f} kg"
|
||||
|
||||
def generate_counter_data(self) -> str:
|
||||
|
||||
Reference in New Issue
Block a user