generated from thinkode/modelRepository
resolve peripheral status
This commit is contained in:
@@ -51,6 +51,7 @@ func (p *FTDIPeripheral) Connect(ctx context.Context) error {
|
||||
serialNumber := C.CString(p.info.SerialNumber)
|
||||
defer C.free(unsafe.Pointer(serialNumber))
|
||||
if C.dmx_connect(p.dmxSender, serialNumber) != C.DMX_OK {
|
||||
runtime.EventsEmit(ctx, string(PeripheralStatus), p.info, "disconnected")
|
||||
log.Error().Str("file", "FTDIPeripheral").Str("s/n", p.info.SerialNumber).Msg("unable to connect the DMX device")
|
||||
return errors.Errorf("unable to connect '%s'")
|
||||
}
|
||||
@@ -92,9 +93,11 @@ func (p *FTDIPeripheral) Activate(ctx context.Context) error {
|
||||
|
||||
err := C.dmx_activate(p.dmxSender)
|
||||
if err != C.DMX_OK {
|
||||
runtime.EventsEmit(ctx, string(PeripheralStatus), p.info, "deactivated")
|
||||
return errors.Errorf("unable to activate the DMX sender!")
|
||||
}
|
||||
|
||||
// Test only
|
||||
C.dmx_setValue(p.dmxSender, C.uint16_t(1), C.uint8_t(255))
|
||||
C.dmx_setValue(p.dmxSender, C.uint16_t(5), C.uint8_t(255))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user