Browse Source

Muse: battery range update and dimm led - release

Philippe G 3 years ago
parent
commit
796d39d0a9
2 changed files with 11 additions and 8 deletions
  1. 10 7
      components/targets/muse/muse.c
  2. 1 1
      main/Kconfig.projbuild

+ 10 - 7
components/targets/muse/muse.c

@@ -7,7 +7,6 @@
 #include <esp_system.h>
 #include <freertos/FreeRTOS.h>
 #include <freertos/task.h>
-//#include <driver/adc.h>
 #include "driver/rmt.h"
 #include "monitor.h"
 #include "targets.h"
@@ -24,14 +23,18 @@
 
 // These values are determined by measuring pulse timing with logic analyzer and adjusting to match datasheet. 
 #define T0H 14  // 0 bit high time
-#define T1H 52 // 1 bit high time
+#define T1H 52  // 1 bit high time
 #define TL  52  // low time for either bit
 
-#define GREEN   0xFF0000
-#define RED 	0x00FF00
-#define BLUE  	0x0000FF
-#define WHITE   0xFFFFFF
-#define YELLOW  0xE0F060
+// sets a color based on RGB from 0..255 and a brightness in % from 0..100
+#define RGB(R,G,B,BR) (((G*BR)/100) << 16) | (((R*BR)/100) << 8) | ((B*BR)/100)
+
+#define RED 	RGB(255,0,0,10)
+#define GREEN   RGB(0,255,0,10)
+#define BLUE  	RGB(0,0,255,10)
+#define WHITE   RGB(255,255,255,10)
+#define YELLOW  RGB(255,118,13,10)
+
 struct led_state {
     uint32_t leds[NUM_LEDS];
 };

+ 1 - 1
main/Kconfig.projbuild

@@ -133,7 +133,7 @@ menu "Squeezelite-ESP32"
 		config BAT_CONFIG
 			string
 			default "channel=7,scale=20.24,atten=0" if SQUEEZEAMP
-			default "channel=5,scale=7.48,atten=3,cells=1" if MUSE
+			default "channel=5,scale=7.00,atten=3,cells=1" if MUSE
 			default ""
 		config TARGET
 			string