First working multiplayer version

This commit is contained in:
Phew
2026-02-11 23:20:46 +01:00
parent 08686e0fd6
commit a11da1b3d8
7 changed files with 284 additions and 163 deletions

View File

@@ -36,17 +36,18 @@ int dac_pin;
void IRAM_ATTR onSoundTimer()
{
if (sound_on) {
dacWrite(dac_pin, (sound_wave_high?sound_volume:0));
//dacWrite(dac_pin, (sound_wave_high?sound_volume:0));
sound_wave_high = ! sound_wave_high;
}
else
dacWrite(dac_pin, 0);
//else
// dacWrite(dac_pin, 0);
}
void sound_init(int pin){ // pin must be a DAC pin number !! (typically 25 or 26)
return;
dac_pin = pin;
sound_on = false;
pinMode(dac_pin, OUTPUT);
//pinMode(dac_pin, OUTPUT);
sound_volume = 0;
#ifdef OLD_CODE
@@ -76,6 +77,7 @@ void sound_resume() // resume from pause ... after eeprom write
}
bool sound(uint16_t freq, uint8_t volume){
return true;
if (volume == 0) {
soundOff();
return false;
@@ -91,6 +93,7 @@ bool sound(uint16_t freq, uint8_t volume){
}
void soundOff(){
return;
sound_on = false;
sound_volume = 0;
//timerAlarmWrite(sndTimer, ESP32_F_CPU/AUDIO_INTERRUPT_PRESCALER/(MIN_FREQ), true); // lower timer freq