diff --git a/Mk1Pinout-Outdated.md b/Mk1Pinout-Outdated.md new file mode 100644 index 0000000..430378f --- /dev/null +++ b/Mk1Pinout-Outdated.md @@ -0,0 +1,20 @@ +|Env Sensor|Grey |x|x| | | +|Env Sensor|Green |x|x|White |RGB Array | +|Env Sensor|Blue |x|x|Grey |RGB Array | +| | |x|x| | | +|Env Sensor|Purple|x|x| | | +| | |x|x| | | +| | |x|x|Brown |Power LED | +| | |x|x|Red |Power LED | +| | |x|x| | | +|RGB Array |Black |x|x|Yellow |Button | +| | |x|x|Yellow |Button | +| | |x|x| | | +|Buzzer |Black |x|x| | | +| | |x|x| | | +| | |x|x|Orange |Notification LED| +| | |x|x|Yellow |Notification LED| +|Buzzer |White |x|x|Green |Warning LED | +| | |x|x|Dark Blue|Warning LED | +|White LED |Red |x|x| | | +|White LED |Brown |x|x| | | \ No newline at end of file diff --git a/Pinout.md b/Pinout.md deleted file mode 100644 index addea1d..0000000 --- a/Pinout.md +++ /dev/null @@ -1,20 +0,0 @@ -|Env Sensor|Grey|x|x| | | -|Env Sensor|Green|x|x|White|RGB Array| -|Env Sensor|Blue|x|x|Grey|RGB Array| -| | |x|x| | | -|Env Sensor|Purple|x|x| | | -| | |x|x| | | -| | |x|x|Brown|Power LED| -| | |x|x|Red|Power LED| -| | |x|x| | | -|RGB Array|Black|x|x|Yellow|Button| -| | |x|x|Yellow|Button| -| | |x|x| | | -|Buzzer|Black|x|x| | | -| | |x|x| | | -| | |x|x|Orange|Notification LED| -| | |x|x|Yellow|Notification LED| -|Buzzer|White|x|x|Green|Warning LED| -| | |x|x|Dark Blue|Warning LED| -|White LED|Red|x|x| | | -|White LED|Brown|x|x| | | \ No newline at end of file diff --git a/ServoSkull.sln b/ServoSkull.sln index e9ed18e..5266c87 100644 --- a/ServoSkull.sln +++ b/ServoSkull.sln @@ -17,7 +17,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EE38A10C-F0BB-40B5-B1E6-8CB16C6E452C}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig - Pinout.md = Pinout.md + Mk1Pinout-Outdated.md = Mk1Pinout-Outdated.md EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "skullOS.API", "skullOS.API\skullOS.API.csproj", "{5E1EC385-4B61-4E8C-82C7-46695A33AC72}" diff --git a/skullOS.HardwareServices/SpeakerService.cs b/skullOS.HardwareServices/SpeakerService.cs index 5263792..baad4c7 100644 --- a/skullOS.HardwareServices/SpeakerService.cs +++ b/skullOS.HardwareServices/SpeakerService.cs @@ -5,7 +5,8 @@ namespace skullOS.HardwareServices { /// /// Service to communicate with audio output - /// Requires `sudo apt install --no-install-recommends vlc-bin vlc-plugin-base` to have been ran first + /// Requires `sudo apt install --no-install-recommends vlc-bin vlc-plugin-base` to have been ran first which isn't on lite os + /// If deploying to a pizero, may also need to do the following: https://learn.adafruit.com/adafruit-max98357-i2s-class-d-mono-amp/raspberry-pi-usage /// public class SpeakerService : ISpeakerService { diff --git a/skullOS.Modules/Camera.cs b/skullOS.Modules/Camera.cs index a778883..95ce260 100644 --- a/skullOS.Modules/Camera.cs +++ b/skullOS.Modules/Camera.cs @@ -15,11 +15,14 @@ public class Camera : Module, ICameraModule { public CameraService CameraService; public MicrophoneService? MicrophoneService = null; + public SpeakerService? SpeakerService = null; public LedService? LedService = null; public CameraMode CameraMode = CameraMode.Image; - public BuzzerService BuzzerService; + public BuzzerService? BuzzerService = null; bool useMic = false; + bool useSpeaker = false; + bool useBuzzer = false; bool isActive = false; public Camera() @@ -53,8 +56,36 @@ public Camera() LedService = new LedService(pins); } } - - BuzzerService = new BuzzerService(13); + if (cameraSettings.ContainsKey("UseBuzzer")) + { + if (cameraSettings.TryGetValue("UseBuzzer", out string shouldUseBuzzer)) + { + if (bool.Parse(shouldUseBuzzer)) + { + BuzzerService = new BuzzerService(13); + useBuzzer = true; + } + else + { + //No Mic desired + } + } + } + if (cameraSettings.ContainsKey("UseSpeaker")) + { + if (cameraSettings.TryGetValue("UseSpeaker", out string shouldUseSpeaker)) + { + if (bool.Parse(shouldUseSpeaker)) + { + SpeakerService = new SpeakerService(); + useSpeaker = true; + } + else + { + //No Mic desired + } + } + } } public async Task TakePicture() @@ -66,7 +97,14 @@ public async Task TakePicture() { LedService.BlinkLight("CameraLight"); } - BuzzerService.Buzzer.PlayTone(1500, 500); + if (useBuzzer) + { + BuzzerService.Buzzer.PlayTone(1500, 500); + } + if (useSpeaker) + { + _ = SpeakerService.PlayAudio(@"Resources\51360__thecheeseman__camera_snap1.mp3"); + } string result = await CameraService.TakePictureAsync($"{FileManager.GetSkullDirectory()}/Captures/"); LogMessage(result); isActive = false; @@ -83,13 +121,24 @@ public async Task RecordShortVideo() { LedService.TurnOn("CameraLight"); } - BuzzerService.Buzzer.PlayTone(1500, 500); + if (useBuzzer) + { + BuzzerService.Buzzer.PlayTone(1500, 500); + } + if (useSpeaker) + { + _ = SpeakerService.PlayAudio(@"Resources\195912__acpascal__start-beep.mp3"); + } string result = await CameraService.RecordShortVideoAsync($"{FileManager.GetSkullDirectory()}/Captures/", false); LogMessage(result); if (LedService != null && LedService.LEDs.ContainsKey("CameraLight")) { LedService.TurnOff("CameraLight"); } + if (useSpeaker) + { + //Play camera stop sound + } isActive = false; } diff --git a/skullOS.Modules/Data/CameraSettings.txt b/skullOS.Modules/Data/CameraSettings.txt index 11ba788..1c90400 100644 --- a/skullOS.Modules/Data/CameraSettings.txt +++ b/skullOS.Modules/Data/CameraSettings.txt @@ -1,2 +1,3 @@ UseMic=False +UseBuzzer=False CameraLight=6 \ No newline at end of file diff --git a/skullOS.Modules/Prop.cs b/skullOS.Modules/Prop.cs index 6b87bc7..3fe5481 100644 --- a/skullOS.Modules/Prop.cs +++ b/skullOS.Modules/Prop.cs @@ -79,7 +79,10 @@ private void PlayIdleSound_Elapsed(object? sender, System.Timers.ElapsedEventArg Random random = new Random(); int selection = random.Next(0, numberOfIdles + 1); SpeakerService.PlayAudio(sounds[selection]); - if (propSettings.ContainsKey("Servos")) + + propSettings.TryGetValue("Servos", out string servosState); + bool useServos = bool.Parse(servosState); + if (propSettings.ContainsKey("Servos") && useServos) { if (random.NextSingle() <= 0.5) { diff --git a/skullOS.Modules/Resources/195912__acpascal__start-beep.mp3 b/skullOS.Modules/Resources/195912__acpascal__start-beep.mp3 new file mode 100644 index 0000000..f93a47c Binary files /dev/null and b/skullOS.Modules/Resources/195912__acpascal__start-beep.mp3 differ diff --git a/skullOS.Modules/Resources/51360__thecheeseman__camera_snap1.mp3 b/skullOS.Modules/Resources/51360__thecheeseman__camera_snap1.mp3 new file mode 100644 index 0000000..5bb917f Binary files /dev/null and b/skullOS.Modules/Resources/51360__thecheeseman__camera_snap1.mp3 differ diff --git a/skullOS.Modules/Resources/Sources.txt b/skullOS.Modules/Resources/Sources.txt index afe7d73..646fe0b 100644 --- a/skullOS.Modules/Resources/Sources.txt +++ b/skullOS.Modules/Resources/Sources.txt @@ -1,2 +1,4 @@ No battery - https://freesound.org/people/DAN2008/sounds/710280/ -Haro Sounds - https://www.101soundboards.com/boards/44920-haro-sd-gundam-g-generation-genesis-combat-dialogue-nintendo-switch \ No newline at end of file +Haro Sounds - https://www.101soundboards.com/boards/44920-haro-sd-gundam-g-generation-genesis-combat-dialogue-nintendo-switch +camera_snap1.wav by thecheeseman -- https://freesound.org/s/51360/ -- License: Attribution 4.0 +Start Beep by ACPascal -- https://freesound.org/s/195912/ -- License: Attribution 4.0 \ No newline at end of file diff --git a/skullOS.Modules/skullOS.Modules.csproj b/skullOS.Modules/skullOS.Modules.csproj index 38efe01..e393531 100644 --- a/skullOS.Modules/skullOS.Modules.csproj +++ b/skullOS.Modules/skullOS.Modules.csproj @@ -22,6 +22,12 @@ Always + + Always + + + Always + PreserveNewest diff --git a/skullOS/Data/Modules.txt b/skullOS/Data/Modules.txt index e4fe3cb..35ee7bf 100644 --- a/skullOS/Data/Modules.txt +++ b/skullOS/Data/Modules.txt @@ -1,2 +1,3 @@ Camera=True -Prop=True \ No newline at end of file +Prop=True +Adventure=True \ No newline at end of file diff --git a/skullOS/Data/SkullInputSettings.txt b/skullOS/Data/SkullInputSettings.txt deleted file mode 100644 index 0902930..0000000 --- a/skullOS/Data/SkullInputSettings.txt +++ /dev/null @@ -1 +0,0 @@ -Camera(Image)=0 \ No newline at end of file diff --git a/skullOS/Data/SkullModules.txt b/skullOS/Data/SkullModules.txt deleted file mode 100644 index 2fcce2f..0000000 --- a/skullOS/Data/SkullModules.txt +++ /dev/null @@ -1,6 +0,0 @@ -Camera=True -Downlink=True -Uplink=True -Prop=True -QrCodeReader=True -Buzzer=True diff --git a/skullOS/skullOS.csproj b/skullOS/skullOS.csproj index 56f4901..cc04f2a 100644 --- a/skullOS/skullOS.csproj +++ b/skullOS/skullOS.csproj @@ -24,12 +24,6 @@ Always - - Always - - - Always -