Merge clean up
This commit is contained in:
@@ -22,7 +22,6 @@ lib_deps =
|
||||
fastled/FastLED@^3.5.0
|
||||
marcmerlin/FastLED NeoMatrix@^1.2
|
||||
knolleary/PubSubClient@^2.8
|
||||
plerup/EspSoftwareSerial@^8.0.1
|
||||
|
||||
[env:awtrix_upgrade]
|
||||
platform = https://github.com/platformio/platform-espressif32.git
|
||||
|
||||
@@ -254,7 +254,7 @@ void AlarmApp(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state)
|
||||
{
|
||||
#ifdef ULANZI
|
||||
PeripheryManager.playFromFile("/MELODIES/" + ALARM_SOUND + ".txt");
|
||||
else
|
||||
#else
|
||||
PeripheryManager.playFromFile(DFMINI_MP3_ALARM);
|
||||
#endif
|
||||
}
|
||||
@@ -280,7 +280,7 @@ void TimerApp(FastLED_NeoMatrix *matrix, MatrixDisplayUiState *state)
|
||||
{
|
||||
#ifdef ULANZI
|
||||
PeripheryManager.playFromFile("/MELODIES/" + TIMER_SOUND + ".txt");
|
||||
else
|
||||
#else
|
||||
PeripheryManager.playFromFile(DFMINI_MP3_TIMER);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -28,8 +28,12 @@ enum MenuState
|
||||
WeekdayMenu,
|
||||
TempMenu,
|
||||
Appmenu,
|
||||
SoundMenu,
|
||||
#ifdef ULANZI
|
||||
SoundMenu
|
||||
#else
|
||||
SoundMenu,
|
||||
VolumeMenu
|
||||
#endif
|
||||
};
|
||||
|
||||
const char *menuItems[] PROGMEM = {
|
||||
@@ -250,10 +254,12 @@ void MenuManager_::rightButton()
|
||||
case TempMenu:
|
||||
IS_CELSIUS = !IS_CELSIUS;
|
||||
break;
|
||||
#ifndef ULANZI
|
||||
case VolumeMenu:
|
||||
VOLUME_PERCENT = (VOLUME_PERCENT % 100) + 1;
|
||||
VOLUME = map(VOLUME_PERCENT, 0, 100, 0, 30);
|
||||
PeripheryManager.setVolume(VOLUME);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -314,10 +320,12 @@ void MenuManager_::leftButton()
|
||||
case SoundMenu:
|
||||
SOUND_ACTIVE = !SOUND_ACTIVE;
|
||||
break;
|
||||
#ifndef ULANZI
|
||||
case VolumeMenu:
|
||||
VOLUME_PERCENT = (VOLUME_PERCENT % 100) + 1;
|
||||
VOLUME = map(VOLUME_PERCENT, 0, 100, 0, 30);
|
||||
PeripheryManager.setVolume(VOLUME);
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -372,11 +380,10 @@ void MenuManager_::selectButton()
|
||||
currentState = SoundMenu;
|
||||
break;
|
||||
case 12:
|
||||
#ifdef AWTRIX_UPGRADE
|
||||
#ifndef ULANZI
|
||||
currentState = VolumeMenu;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
case 13:
|
||||
if (UpdateManager.checkUpdate(true))
|
||||
{
|
||||
@@ -454,8 +461,8 @@ void MenuManager_::selectButtonLong()
|
||||
DisplayManager.applyAllSettings();
|
||||
saveSettings();
|
||||
break;
|
||||
#ifndef ULANZI
|
||||
case VolumeMenu:
|
||||
#ifdef AWTRIX_UPGRADE
|
||||
VOLUME = map(VOLUME_PERCENT, 0, 100, 0, 30);
|
||||
saveSettings();
|
||||
#endif
|
||||
|
||||
@@ -41,14 +41,7 @@
|
||||
#ifdef ULANZI
|
||||
Adafruit_SHT31 sht31;
|
||||
#else
|
||||
|
||||
class Mp3Notify
|
||||
{
|
||||
};
|
||||
Adafruit_BME280 bme280;
|
||||
SoftwareSerial mySoftwareSerial(D7, D5); // RX, TX
|
||||
typedef DFMiniMp3<SoftwareSerial, Mp3Notify> DfMp3;
|
||||
DfMp3 dfmp3(mySoftwareSerial);
|
||||
#endif
|
||||
|
||||
EasyButton button_left(BUTTON_UP_PIN);
|
||||
@@ -57,9 +50,6 @@ EasyButton button_select(BUTTON_SELECT_PIN);
|
||||
#ifdef ULANZI
|
||||
MelodyPlayer player(BUZZER_PIN, LOW);
|
||||
#else
|
||||
// implement a notification class,
|
||||
// its member methods will get called
|
||||
//
|
||||
class Mp3Notify{};
|
||||
SoftwareSerial mySoftwareSerial(DFPLAYER_RX, DFPLAYER_TX); // RX, TX
|
||||
DFMiniMp3<SoftwareSerial, Mp3Notify> dfmp3(mySoftwareSerial);
|
||||
@@ -88,11 +78,6 @@ float sampleSum = 0.0;
|
||||
float sampleAverage = 0.0;
|
||||
float brightnessPercent = 0.0;
|
||||
|
||||
#ifdef awrtrix_upgrade
|
||||
class Mp3Notify;
|
||||
SoftwareSerial mySoftwareSerial(D7, D5); // RX, TX
|
||||
#endif
|
||||
|
||||
// The getter for the instantiated singleton instance
|
||||
PeripheryManager_ &PeripheryManager_::getInstance()
|
||||
{
|
||||
@@ -168,13 +153,12 @@ void PeripheryManager_::playBootSound()
|
||||
if (BOOT_SOUND == "")
|
||||
{
|
||||
#ifdef ULANZI
|
||||
// no standardsound
|
||||
const int nNotes = 6;
|
||||
String notes[nNotes] = {"E5", "C5", "G4", "E4", "G4", "C5"};
|
||||
const int timeUnit = 150;
|
||||
Melody melody = MelodyFactory.load("Bootsound", timeUnit, notes, nNotes);
|
||||
player.playAsync(melody);
|
||||
#else
|
||||
// no standardsound
|
||||
#endif
|
||||
}
|
||||
else
|
||||
@@ -198,12 +182,12 @@ void PeripheryManager_::stopSound()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef ULANZI
|
||||
void PeripheryManager_::setVolume(uint8_t vol)
|
||||
{
|
||||
#ifdef AWTRIX_UPGRADE
|
||||
dfmp3.setVolume(vol);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void PeripheryManager_::playFromFile(String file)
|
||||
{
|
||||
@@ -258,7 +242,7 @@ void PeripheryManager_::setup()
|
||||
#else
|
||||
dfmp3.begin();
|
||||
delay(50);
|
||||
dfmp3.setVolume(20);
|
||||
dfmp3.setVolume(20); // Set initial value to saved setting MISSING!
|
||||
#endif
|
||||
button_left.begin();
|
||||
button_right.begin();
|
||||
|
||||
@@ -35,7 +35,9 @@ public:
|
||||
void playFromFile(String file);
|
||||
bool isPlaying();
|
||||
void stopSound();
|
||||
#ifndef ULANZI
|
||||
void setVolume(uint8_t);
|
||||
#endif
|
||||
const char *readUptime();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user