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