void SioWorker::swapDevices(quint8 d1, quint8 d2) { SioDevice *t1, *t2; deviceMutex->lock(); t1 = devices[d1]; t2 = devices[d2]; uninstallDevice(d1); uninstallDevice(d2); if (t2) { installDevice(d1, t2); } if (t1) { installDevice(d2, t1); } deviceMutex->unlock(); }
/** * Sets devices to their unconfigured states. Each device is initialized to a static no-op instance. * This method is idempotent, and is called each time the eeprom is reset. */ void DeviceManager::setupUnconfiguredDevices() { // right now, uninstall doesn't care about chamber/beer distinction. // but this will need to match beer/function when multiferment is available DeviceConfig cfg; cfg.chamber = 1; cfg.beer = 1; for (uint8_t i=0; i<DEVICE_MAX; i++) { cfg.deviceFunction = DeviceFunction(i); uninstallDevice(cfg); } }