Переглянути джерело

Extended Readme, slight modifications

Thomas Buck 9 роки тому
джерело
коміт
6e555618d7
3 змінених файлів з 26 додано та 13 видалено
  1. 16
    11
      CaseLights/AppDelegate.m
  2. 1
    1
      CaseLights/Info.plist
  3. 9
    1
      README.md

+ 16
- 11
CaseLights/AppDelegate.m Переглянути файл

@@ -47,6 +47,10 @@
47 47
 #define RAM_COLOR_MIN 0
48 48
 #define RAM_COLOR_MAX 120
49 49
 
50
+// You can play around with these values (skipped pixels, display timer delay) to change CPU usage in display mode
51
+#define AVERAGE_COLOR_PERFORMANCE_INC 10
52
+#define DISPLAY_DELAY 0.1
53
+
50 54
 @interface AppDelegate ()
51 55
 
52 56
 @property (strong) NSStatusItem *statusItem;
@@ -480,7 +484,7 @@
480 484
     }
481 485
     
482 486
     // Schedule next invocation for this animation...
483
-    animation = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(visualizeDisplay:) userInfo:[NSNumber numberWithInteger:[sender tag]] repeats:YES];
487
+    animation = [NSTimer scheduledTimerWithTimeInterval:DISPLAY_DELAY target:self selector:@selector(visualizeDisplay:) userInfo:[NSNumber numberWithInteger:[sender tag]] repeats:YES];
484 488
     
485 489
     // ...and also execute it right now
486 490
     [animation fire];
@@ -635,16 +639,17 @@
635 639
     }
636 640
     
637 641
     unsigned char *data = [screen bitmapData];
638
-    unsigned long long width = [screen pixelsWide];
639
-    unsigned long long height = [screen pixelsHigh];
640
-    unsigned long long max = width * height;
641
-    unsigned long long red = 0, green = 0, blue = 0;
642
-    for (unsigned long long i = 0; i < max; i++) {
643
-        red += data[(spp * i) + redC];
644
-        green += data[(spp * i) + greenC];
645
-        blue += data[(spp * i) + blueC];
646
-    }
647
-    
642
+    unsigned long width = [screen pixelsWide];
643
+    unsigned long height = [screen pixelsHigh];
644
+    unsigned long max = width * height;
645
+    unsigned long red = 0, green = 0, blue = 0;
646
+    for (unsigned long i = 0; i < max; i += AVERAGE_COLOR_PERFORMANCE_INC) {
647
+        unsigned long off = spp * i;
648
+        red += data[off + redC];
649
+        green += data[off + greenC];
650
+        blue += data[off + blueC];
651
+    }
652
+    max /= AVERAGE_COLOR_PERFORMANCE_INC;
648 653
     [self setLightsR:(red / max) G:(green / max) B:(blue / max)];
649 654
 }
650 655
 

+ 1
- 1
CaseLights/Info.plist Переглянути файл

@@ -21,7 +21,7 @@
21 21
 	<key>CFBundleSignature</key>
22 22
 	<string>????</string>
23 23
 	<key>CFBundleVersion</key>
24
-	<string>142</string>
24
+	<string>153</string>
25 25
 	<key>LSApplicationCategoryType</key>
26 26
 	<string>public.app-category.utilities</string>
27 27
 	<key>LSMinimumSystemVersion</key>

+ 9
- 1
README.md Переглянути файл

@@ -8,11 +8,19 @@ You could connect pretty much any hardware. I’m using a N-Channel MOSFET Setup
8 8
 
9 9
 [![fritzing Schematic](https://i.imgur.com/jWLW22F.png)](https://i.imgur.com/sXAADUs.png)
10 10
 
11
+My finished setup is made with a cheap Arduino Pro Mini clone from China and a [dead simple RS232-TTL converter](http://picprojects.org.uk/projects/simpleSIO/ssio.htm) connected to its serial port. You may need to change `Serial` to `Serial1` in the Sketch if you’re trying to do this with an Arduino Leonardo, as I did at first.
12
+
13
+Uncomment the `#define DEBUG` at the beginning of the Sketch to enable very verbose debug messages sent on the serial port. This is not recommended for use with the CaseLights App.
14
+
11 15
 ## Mac OS X App
12 16
 
13 17
 The CaseLights XCode project includes the JSystemInfoKit project from the submodule in this repository. Just run `xcodebuild` on the command line or open the project in XCode and click `Run` to start the App.
14 18
 
15
-![Screenshot](https://i.imgur.com/N7j7BJV.png)
19
+![Screenshot](https://i.imgur.com/K7HuJPK.png)
20
+
21
+CaseLights is only visible in the system menu bar. You can enable or disable the fourth channel (used for UV lighting in my case), set the RGB LEDs to static colors or simple animations, and select different visualizations for the RGB LEDs like CPU, GPU and RAM usage or hardware temperatures. The minimum and maximum values for these modes are hardcoded, but can be modified easily.
22
+
23
+You can also select one of the displays connected to the Host machine. The CaseLights App will then create a Screenshot of this display 10-times per second and calculate the average color to display it on the RGB LEDs.
16 24
 
17 25
 ## Working with Git Submodules
18 26
 

Завантаження…
Відмінити
Зберегти