Skip to content

Commit

Permalink
#51 Final Pre-con prep
Browse files Browse the repository at this point in the history
Fixed the Mk1 pinout diagram even though it's old
Removed the surplus config files
  • Loading branch information
David032 committed Mar 22, 2024
1 parent 20ac58d commit b71d746
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 43 deletions.
20 changes: 20 additions & 0 deletions Mk1Pinout-Outdated.md
Original file line number Diff line number Diff line change
@@ -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| | |
20 changes: 0 additions & 20 deletions Pinout.md

This file was deleted.

2 changes: 1 addition & 1 deletion ServoSkull.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
3 changes: 2 additions & 1 deletion skullOS.HardwareServices/SpeakerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ namespace skullOS.HardwareServices
{
/// <summary>
/// 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
/// </summary>
public class SpeakerService : ISpeakerService
{
Expand Down
59 changes: 54 additions & 5 deletions skullOS.Modules/Camera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Check warning on line 23 in skullOS.Modules/Camera.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

The field 'Camera.useMic' is assigned but its value is never used

Check warning on line 23 in skullOS.Modules/Camera.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

The field 'Camera.useMic' is assigned but its value is never used
bool useSpeaker = false;
bool useBuzzer = false;
bool isActive = false;

public Camera()
Expand Down Expand Up @@ -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()
Expand All @@ -66,7 +97,14 @@ public async Task TakePicture()
{
LedService.BlinkLight("CameraLight");
}
BuzzerService.Buzzer.PlayTone(1500, 500);
if (useBuzzer)
{
BuzzerService.Buzzer.PlayTone(1500, 500);

Check warning on line 102 in skullOS.Modules/Camera.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 102 in skullOS.Modules/Camera.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.
}
if (useSpeaker)
{
_ = SpeakerService.PlayAudio(@"Resources\51360__thecheeseman__camera_snap1.mp3");

Check warning on line 106 in skullOS.Modules/Camera.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 106 in skullOS.Modules/Camera.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.
}
string result = await CameraService.TakePictureAsync($"{FileManager.GetSkullDirectory()}/Captures/");
LogMessage(result);
isActive = false;
Expand All @@ -83,13 +121,24 @@ public async Task RecordShortVideo()
{
LedService.TurnOn("CameraLight");
}
BuzzerService.Buzzer.PlayTone(1500, 500);
if (useBuzzer)
{
BuzzerService.Buzzer.PlayTone(1500, 500);

Check warning on line 126 in skullOS.Modules/Camera.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 126 in skullOS.Modules/Camera.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.
}
if (useSpeaker)
{
_ = SpeakerService.PlayAudio(@"Resources\195912__acpascal__start-beep.mp3");

Check warning on line 130 in skullOS.Modules/Camera.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 130 in skullOS.Modules/Camera.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.
}
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;
}

Expand Down
1 change: 1 addition & 0 deletions skullOS.Modules/Data/CameraSettings.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
UseMic=False
UseBuzzer=False
CameraLight=6
5 changes: 4 additions & 1 deletion skullOS.Modules/Prop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Check warning on line 84 in skullOS.Modules/Prop.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Possible null reference argument for parameter 'value' in 'bool bool.Parse(string value)'.

Check warning on line 84 in skullOS.Modules/Prop.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Possible null reference argument for parameter 'value' in 'bool bool.Parse(string value)'.
if (propSettings.ContainsKey("Servos") && useServos)
{
if (random.NextSingle() <= 0.5)
{
Expand Down
Binary file not shown.
Binary file not shown.
4 changes: 3 additions & 1 deletion skullOS.Modules/Resources/Sources.txt
Original file line number Diff line number Diff line change
@@ -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
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
6 changes: 6 additions & 0 deletions skullOS.Modules/skullOS.Modules.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
<None Update="Data\PropSettings.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Resources\195912__acpascal__start-beep.mp3">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Resources\51360__thecheeseman__camera_snap1.mp3">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Resources\710280__dan2008__no-battery.mp3">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
3 changes: 2 additions & 1 deletion skullOS/Data/Modules.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
Camera=True
Prop=True
Prop=True
Adventure=True
1 change: 0 additions & 1 deletion skullOS/Data/SkullInputSettings.txt

This file was deleted.

6 changes: 0 additions & 6 deletions skullOS/Data/SkullModules.txt

This file was deleted.

6 changes: 0 additions & 6 deletions skullOS/skullOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
<None Update="Data\Modules.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Data\SkullInputSettings.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Data\SkullModules.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

0 comments on commit b71d746

Please sign in to comment.