update emulator
This commit is contained in:
@@ -19,6 +19,8 @@ type DeviceState struct {
|
||||
// W4=40 (Time Window), W20=128 (Gain)
|
||||
params map[int]int
|
||||
|
||||
ncParam bool // NC parameter: true = NO (1), false = NC (0), default is NO
|
||||
|
||||
sensorValue int // Default 2067 (ideal rest value)
|
||||
jitterRange int // Default 10 (means ±10)
|
||||
|
||||
@@ -41,6 +43,7 @@ func NewDeviceState() *DeviceState {
|
||||
12: 1000, // W12 - Max Pulse Duration (max)
|
||||
20: 127, // W20 - Gain (middle of 0-255)
|
||||
},
|
||||
ncParam: true, // Default NO mode (1)
|
||||
sensorValue: 2067,
|
||||
jitterRange: 10,
|
||||
connectedClients: 0,
|
||||
@@ -129,6 +132,7 @@ func (s *DeviceState) ResetToDefaults() {
|
||||
12: 1000,
|
||||
20: 127,
|
||||
}
|
||||
s.ncParam = true // Default NO mode (1)
|
||||
s.sensorValue = 2067
|
||||
s.jitterRange = 10
|
||||
}
|
||||
@@ -176,6 +180,20 @@ func (s *DeviceState) GetAlarmState() (bool, string) {
|
||||
return s.alarmActive, s.alarmType
|
||||
}
|
||||
|
||||
// GetNCParam returns the NC parameter value (true = NO, false = NC)
|
||||
func (s *DeviceState) GetNCParam() bool {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
return s.ncParam
|
||||
}
|
||||
|
||||
// SetNCParam sets the NC parameter value (true = NO, false = NC)
|
||||
func (s *DeviceState) SetNCParam(value bool) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
s.ncParam = value
|
||||
}
|
||||
|
||||
// GetAllParams returns a copy of all parameters
|
||||
func (s *DeviceState) GetAllParams() map[int]int {
|
||||
s.mu.RLock()
|
||||
|
||||
Reference in New Issue
Block a user