From b824f900d9ab6f6df849217aa328a52f94df4cd3 Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 23 Apr 2018 23:19:31 +0100 Subject: [PATCH 1/3] Fixup as in PR commits. --- src/main/cms/cms.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/cms/cms.c b/src/main/cms/cms.c index eb59a06448..466c32ab21 100644 --- a/src/main/cms/cms.c +++ b/src/main/cms/cms.c @@ -68,6 +68,10 @@ #include "rx/rx.h" +#ifdef USE_USB_CDC_HID +#include "sensors/battery.h" +#endif + // DisplayPort management #ifndef CMS_MAX_DEVICE @@ -993,6 +997,11 @@ void cmsUpdate(uint32_t currentTimeUs) return ; } #endif +#ifdef USE_USB_CDC_HID + if (getBatteryCellCount() == 0) { + return; + } +#endif static int16_t rcDelayMs = BUTTON_TIME; static int holdCount = 1; From 641e555e7b995c25d65a5cef762df6efa32f87fb Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 30 Apr 2018 00:51:14 +0200 Subject: [PATCH 2/3] Check if HID is actually enabled in options. --- src/main/cms/cms.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/cms/cms.c b/src/main/cms/cms.c index 466c32ab21..771f2f3243 100644 --- a/src/main/cms/cms.c +++ b/src/main/cms/cms.c @@ -70,6 +70,8 @@ #ifdef USE_USB_CDC_HID #include "sensors/battery.h" +#include "pg/pg.h" +#include "pg/usb.h" #endif // DisplayPort management @@ -998,7 +1000,7 @@ void cmsUpdate(uint32_t currentTimeUs) } #endif #ifdef USE_USB_CDC_HID - if (getBatteryCellCount() == 0) { + if (getBatteryCellCount() == 0 && usbDevConfig()->type == COMPOSITE) { return; } #endif From 8cbd91c9eed6629813f8509f304eabcb5f302e5d Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 30 Apr 2018 01:02:02 +0200 Subject: [PATCH 3/3] Duplicate include --- src/main/cms/cms.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/cms/cms.c b/src/main/cms/cms.c index 771f2f3243..d7f86e388d 100644 --- a/src/main/cms/cms.c +++ b/src/main/cms/cms.c @@ -70,7 +70,6 @@ #ifdef USE_USB_CDC_HID #include "sensors/battery.h" -#include "pg/pg.h" #include "pg/usb.h" #endif