From 6f9f6d51d2bbfc35dc1241101849abc707372029 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Thu, 17 Dec 2020 16:11:11 +0100 Subject: [PATCH] changeDevice --- cube/User/Src/config.c | 6 +++++- cube/User/Src/configCmds.c | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cube/User/Src/config.c b/cube/User/Src/config.c index 59266c8..b9f5111 100644 --- a/cube/User/Src/config.c +++ b/cube/User/Src/config.c @@ -150,7 +150,11 @@ void configInit() { tmpDeviceBlock.consideredField[1], tmpDeviceBlock.consideredField[2], tmpDeviceBlock.consideredField[3]); - mbusCommAddDevice(&tmpDeviceBlock); + if (tmpDeviceBlock.period == 0) { + coloredMsg(LOG_BLUE, false, " device is marked as inactive"); + } else { + mbusCommAddDevice(&tmpDeviceBlock); + } } else { coloredMsg(LOG_BLUE, false, "magic of device %d does not match, ignored", i); } diff --git a/cube/User/Src/configCmds.c b/cube/User/Src/configCmds.c index 2f93bee..2508576 100644 --- a/cube/User/Src/configCmds.c +++ b/cube/User/Src/configCmds.c @@ -245,13 +245,17 @@ static bool changeDeviceCmd(uint8_t argc, char **args) { bool retCode = makeDevice(1, argc, args, &deviceBlock); if (retCode) { - sendString("Changed device would be:\n\r"); + sendString("Changed device will be:\n\r"); sendFormatString(" Index: %d\n\r", index); sendFormatString(" Name: %s, Address: %d, Period: %d\n\r", deviceBlock.deviceName, deviceBlock.address, deviceBlock.period); for (uint8_t i = 0; i < MBUSDEVICE_NUM_OF_CONSIDEREDFIELDS; i++) { sendFormatString(" Considered field: %d\n\r", deviceBlock.consideredField[i]); } + if (deviceBlock.period == 0) { + sendString(" Device is marked as inactive\n\r"); + } + eepromWriteDeviceBlock(index, &deviceBlock); } return retCode;