Преглед изворни кода

Fix direct injection to the VS10xx + displaynotifier.

Jordy Sipkema пре 9 година
родитељ
комит
f222c816be
4 измењених фајлова са 15 додато и 2 уклоњено
  1. 4 2
      contentparser.c
  2. 2 0
      main.c
  3. 8 0
      mp3stream.c
  4. 1 0
      mp3stream.h

+ 4 - 2
contentparser.c

@@ -126,8 +126,10 @@ void parseCommandQue(char* content){
         if (jsoneq(content, &token[i], "command") == 0) {
             if(jsoneq(content, &token[i + 1], "volume") == 0){
                 char vol = getIntegerToken(content, &token[i + 3]);
-                vol = 128 - ((vol * 128) / 100);
-                VsSetVolume(vol, vol);
+                printf("Updating volume: \n");
+                setVolumeManual(vol);
+                //vol = 128 - ((vol * 128) / 100);
+                //VsSetVolume(vol, vol);
                 i += 3;
             }else if(jsoneq(content, &token[i + 1], "stopstream") == 0){
                 killPlayerThread();

+ 2 - 0
main.c

@@ -307,6 +307,8 @@ int main(void)
 
     X12RtcGetClock(&timeCheck);
 
+    printf("Welcome to Saltyradio.\nI'm using mac address:  %s\n\n\n", getMacAdress());
+
     for (;;)
     {
         //Key detecten

+ 8 - 0
mp3stream.c

@@ -10,6 +10,7 @@
 #include <sys/thread.h>
 #include <sys/timer.h>
 
+#include "displayHandler.h"
 #include "vs10xx.h"
 
 #define OK              1
@@ -144,6 +145,13 @@ void volumeDown(void)
     setVolume();
 }
 
+void setVolumeManual(char level){
+    u_char v_level = level * 16 / 100;
+    VS_volume = v_level % 17;
+    setVolume();
+    setCurrentDisplay(DISPLAY_Volume, 5);
+}
+
 void setVolume(void){
     u_char volumeToSet = (128 - (VS_volume * 8)) % 129;
     VsSetVolume(volumeToSet, volumeToSet);

+ 1 - 0
mp3stream.h

@@ -19,6 +19,7 @@ void killPlayerThread(void);
 
 void volumeUp(void);
 void volumeDown(void);
+void setVolumeManual(char);
 void setVolume(void); // Do not use this one, this is invoked by volumeUp/Down
 u_char getVolume(void);