From 064bd362e2080aaf7304a0cec922584e4f29859f Mon Sep 17 00:00:00 2001 From: Alexander Thomas Date: Sat, 21 Apr 2018 21:36:56 +0200 Subject: [PATCH 1/5] Add option to toggle tune played when heaters reach target temperature --- .../src/MightyBoard/Motherboard/EepromMap.hh | 5 ++++ .../MightyBoard/Motherboard/Motherboard.cc | 4 ++- firmware/src/MightyBoard/shared/Menu.cc | 30 +++++++++++++++++-- firmware/src/MightyBoard/shared/Menu.hh | 1 + .../src/MightyBoard/shared/locale/Menu.DE.cc | 3 +- .../src/MightyBoard/shared/locale/Menu.EN.cc | 1 + .../src/MightyBoard/shared/locale/Menu.FR.cc | 1 + .../src/MightyBoard/shared/locale/locale.hh | 1 + 8 files changed, 42 insertions(+), 4 deletions(-) diff --git a/firmware/src/MightyBoard/Motherboard/EepromMap.hh b/firmware/src/MightyBoard/Motherboard/EepromMap.hh index b50d08ec..2f4683d9 100644 --- a/firmware/src/MightyBoard/Motherboard/EepromMap.hh +++ b/firmware/src/MightyBoard/Motherboard/EepromMap.hh @@ -39,6 +39,8 @@ enum LEDColors { LED_DEFAULT_CUSTOM }; +#define DEFAULT_BUZZ_ON 1 +#define DEFAULT_BUZZ_HEAT 1 #if BOARD_TYPE == BOARD_TYPE_AZTEEG_X3 @@ -653,6 +655,9 @@ namespace buzz_eeprom_offsets{ //$type:B $constraints:l,0,1 $tooltip:Check or set to 1 to play bot sounds. Uncheck or set to 0 for no sounds. const static uint16_t SOUND_ON = 0x00; //$BEGIN_ENTRY +//$type:B $constraints:l,0,1 $tooltip:Check or set to 1 to play temperatures reached tune. Uncheck or set to 0 for no tune. +const static uint16_t HEAT_BUZZ_OFFSET = 0x02; +//$BEGIN_ENTRY //$type:B $ignore:True $constraints:l,0,1 const static uint16_t ERROR_BUZZ_OFFSET = 0x04; //$BEGIN_ENTRY diff --git a/firmware/src/MightyBoard/Motherboard/Motherboard.cc b/firmware/src/MightyBoard/Motherboard/Motherboard.cc index 94a3b024..2c37214a 100644 --- a/firmware/src/MightyBoard/Motherboard/Motherboard.cc +++ b/firmware/src/MightyBoard/Motherboard/Motherboard.cc @@ -551,7 +551,9 @@ void Motherboard::HeatingAlerts() { else { if ( heating_lights_active ) { heating_lights_active = false; - Piezo::playTune(TUNE_FILAMENT_START); + if ( eeprom::getEeprom8(eeprom_offsets::BUZZ_SETTINGS + buzz_eeprom_offsets::HEAT_BUZZ_OFFSET, + DEFAULT_BUZZ_HEAT) ) + Piezo::playTune(TUNE_FILAMENT_START); #ifdef HAS_RGB_LED RGB_LED::setDefaultColor(); #endif diff --git a/firmware/src/MightyBoard/shared/Menu.cc b/firmware/src/MightyBoard/shared/Menu.cc index 213450cf..7d4fbbef 100644 --- a/firmware/src/MightyBoard/shared/Menu.cc +++ b/firmware/src/MightyBoard/shared/Menu.cc @@ -621,6 +621,11 @@ void SelectAlignmentMenu::handleSelect(uint8_t index) { #endif // !SINGLE_EXTRUDER void FilamentScreen::startMotor(){ + // If the general heater tune is disabled, do play filament loading tune here. + if ( ! eeprom::getEeprom8(eeprom_offsets::BUZZ_SETTINGS + buzz_eeprom_offsets::HEAT_BUZZ_OFFSET, + DEFAULT_BUZZ_HEAT) ) + Piezo::playTune(TUNE_FILAMENT_START); + //So we don't prime after a pause command::pauseUnRetractClear(); @@ -3899,7 +3904,8 @@ void SettingsMenu::resetState() { #if EXTRUDERS > 1 singleExtruder = 2 != eeprom::getEeprom8(eeprom_offsets::TOOL_COUNT, 1); #endif - soundOn = 0 != eeprom::getEeprom8(eeprom_offsets::BUZZ_SETTINGS, 1); + soundOn = 0 != eeprom::getEeprom8(eeprom_offsets::BUZZ_SETTINGS + buzz_eeprom_offsets::SOUND_ON, DEFAULT_BUZZ_ON); + soundHeatOn = 0 != eeprom::getEeprom8(eeprom_offsets::BUZZ_SETTINGS + buzz_eeprom_offsets::HEAT_BUZZ_OFFSET, DEFAULT_BUZZ_HEAT); accelerationOn = 0 != eeprom::getEeprom8(eeprom_offsets::ACCELERATION_SETTINGS + acceleration_eeprom_offsets::ACCELERATION_ACTIVE, 0x01); overrideGcodeTempOn = 0 != eeprom::getEeprom8(eeprom_offsets::OVERRIDE_GCODE_TEMP, 0); pauseHeatOn = 0 != eeprom::getEeprom8(eeprom_offsets::HEAT_DURING_PAUSE, DEFAULT_HEAT_DURING_PAUSE); @@ -3965,6 +3971,12 @@ void SettingsMenu::drawItem(uint8_t index, LiquidCrystalSerial& lcd) { } lind++; + if ( index == lind ) { + msg = SOUND_HEAT_MSG; + test = soundHeatOn; + } + lind++; + if ( index == lind ) { msg = ACCELERATE_MSG; test = accelerationOn; @@ -4102,6 +4114,11 @@ void SettingsMenu::handleCounterUpdate(uint8_t index, int8_t up) { } lind++; + if ( index == lind ) { + soundHeatOn = !soundHeatOn; + } + lind++; + if ( index == lind ) { accelerationOn = !accelerationOn; } @@ -4207,13 +4224,22 @@ void SettingsMenu::handleSelect(uint8_t index) { lind++; if ( index == lind ) { - eeprom_write_byte((uint8_t*)eeprom_offsets::BUZZ_SETTINGS, + eeprom_write_byte((uint8_t*)eeprom_offsets::BUZZ_SETTINGS + + buzz_eeprom_offsets::SOUND_ON, soundOn ? 1 : 0); Piezo::reset(); flags = SETTINGS_LINEUPDATE; } lind++; + if ( index == lind ) { + eeprom_write_byte((uint8_t*)eeprom_offsets::BUZZ_SETTINGS + + buzz_eeprom_offsets::HEAT_BUZZ_OFFSET, + soundHeatOn ? 1 : 0); + flags = SETTINGS_LINEUPDATE; + } + lind++; + if ( index == lind ) { eeprom_write_byte((uint8_t*)eeprom_offsets::ACCELERATION_SETTINGS + acceleration_eeprom_offsets::ACCELERATION_ACTIVE, diff --git a/firmware/src/MightyBoard/shared/Menu.hh b/firmware/src/MightyBoard/shared/Menu.hh index ee8ce742..b07704a6 100644 --- a/firmware/src/MightyBoard/shared/Menu.hh +++ b/firmware/src/MightyBoard/shared/Menu.hh @@ -834,6 +834,7 @@ private: bool singleExtruder; #endif bool soundOn; + bool soundHeatOn; #ifdef HAS_RGB_LED bool heatingLEDOn; #ifdef RGB_LED_MENU diff --git a/firmware/src/MightyBoard/shared/locale/Menu.DE.cc b/firmware/src/MightyBoard/shared/locale/Menu.DE.cc index 4c3a9ccf..d127fc83 100644 --- a/firmware/src/MightyBoard/shared/locale/Menu.DE.cc +++ b/firmware/src/MightyBoard/shared/locale/Menu.DE.cc @@ -142,7 +142,8 @@ const PROGMEM prog_uchar RESET_MSG[] = "Einstellungen RESET"; const PROGMEM prog_uchar NOZZLES_MSG[] = "Duesen kalibrieren"; const PROGMEM prog_uchar BOT_STATS_MSG[] = "Bot Statistik"; const PROGMEM prog_uchar TOOL_COUNT_MSG[] = "Duesen"; -const PROGMEM prog_uchar SOUND_MSG[] = "Sound"; +const PROGMEM prog_uchar SOUND_MSG[] = "Ton"; +const PROGMEM prog_uchar SOUND_MSG[] = "Heizungston"; //const PROGMEM prog_uchar LED_HEAT_MSG[] = "Heiz LEDs"; const PROGMEM prog_uchar EXIT_MSG[] = "Exit Menue"; const PROGMEM prog_uchar ACCELERATE_MSG[] = "Beschleunigung"; diff --git a/firmware/src/MightyBoard/shared/locale/Menu.EN.cc b/firmware/src/MightyBoard/shared/locale/Menu.EN.cc index a93d2a6a..fb9211b3 100644 --- a/firmware/src/MightyBoard/shared/locale/Menu.EN.cc +++ b/firmware/src/MightyBoard/shared/locale/Menu.EN.cc @@ -125,6 +125,7 @@ const PROGMEM prog_uchar NOZZLES_MSG[] = "Calibrate Nozzles"; const PROGMEM prog_uchar BOT_STATS_MSG[] = "Bot Statistics"; const PROGMEM prog_uchar TOOL_COUNT_MSG[] = "Extruder Count"; const PROGMEM prog_uchar SOUND_MSG[] = "Sound"; +const PROGMEM prog_uchar SOUND_HEAT_MSG[] = "Heaters Sound"; //const PROGMEM prog_uchar LED_HEAT_MSG[] = "Heat LEDs"; const PROGMEM prog_uchar EXIT_MSG[] = "Exit Menu"; const PROGMEM prog_uchar ACCELERATE_MSG[] = "Acceleration"; diff --git a/firmware/src/MightyBoard/shared/locale/Menu.FR.cc b/firmware/src/MightyBoard/shared/locale/Menu.FR.cc index 5f612c3b..b6b5a1bd 100644 --- a/firmware/src/MightyBoard/shared/locale/Menu.FR.cc +++ b/firmware/src/MightyBoard/shared/locale/Menu.FR.cc @@ -109,6 +109,7 @@ const PROGMEM prog_uchar NOZZLES_MSG[] = "Calibration Buses"; const PROGMEM prog_uchar BOT_STATS_MSG[] = "Bot Statistics"; const PROGMEM prog_uchar TOOL_COUNT_MSG[] = "Nb Tetes:"; const PROGMEM prog_uchar SOUND_MSG[] = "Son"; +const PROGMEM prog_uchar SOUND_HEAT_MSG[] = "Son Chauffage"; //const PROGMEM prog_uchar LED_HEAT_MSG[] = "Coul Chauf"; const PROGMEM prog_uchar EXIT_MSG[] = "Sortir du Menu"; const PROGMEM prog_uchar ACCELERATE_MSG[] = "Acceleration"; diff --git a/firmware/src/MightyBoard/shared/locale/locale.hh b/firmware/src/MightyBoard/shared/locale/locale.hh index 65051e14..854dcfdf 100644 --- a/firmware/src/MightyBoard/shared/locale/locale.hh +++ b/firmware/src/MightyBoard/shared/locale/locale.hh @@ -139,6 +139,7 @@ extern const unsigned char NOZZLES_MSG[]; extern const unsigned char BOT_STATS_MSG[]; extern const unsigned char TOOL_COUNT_MSG[]; extern const unsigned char SOUND_MSG[]; +extern const unsigned char SOUND_HEAT_MSG[]; //extern const unsigned char LED_HEAT_MSG[]; extern const unsigned char EXIT_MSG[]; extern const unsigned char ACCELERATE_MSG[]; From d9122e3e04327b882f59e07d56e8d8ff6b746636 Mon Sep 17 00:00:00 2001 From: Alexander Thomas Date: Sat, 21 Apr 2018 21:49:29 +0200 Subject: [PATCH 2/5] Make M72 command work according to spec and remove some unused cruft --- firmware/src/MightyBoard/Motherboard/Command.cc | 4 +--- .../src/MightyBoard/Motherboard/EepromMap.cc | 15 ++------------- firmware/src/MightyBoard/Motherboard/Piezo.cc | 16 +--------------- 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/firmware/src/MightyBoard/Motherboard/Command.cc b/firmware/src/MightyBoard/Motherboard/Command.cc index cc600f90..b7c1df48 100644 --- a/firmware/src/MightyBoard/Motherboard/Command.cc +++ b/firmware/src/MightyBoard/Motherboard/Command.cc @@ -2043,10 +2043,8 @@ void runCommandSlice() { LINE_NUMBER_INCR; if(songId == 0) Piezo::errorTone(4); - else if (songId == 1 ) - Piezo::playTune(TUNE_PRINT_DONE); else - Piezo::errorTone(2); + Piezo::playTune(songId); } #if defined(PSTOP_SUPPORT) // Helpful at end of print diff --git a/firmware/src/MightyBoard/Motherboard/EepromMap.cc b/firmware/src/MightyBoard/Motherboard/EepromMap.cc index c75acc47..e0f27854 100644 --- a/firmware/src/MightyBoard/Motherboard/EepromMap.cc +++ b/firmware/src/MightyBoard/Motherboard/EepromMap.cc @@ -190,25 +190,14 @@ void setCustomColor(uint8_t red, uint8_t green, uint8_t blue) { sizeof(colors)); } - /** - * - * @param sound desired - * @param dest in eeprom - */ -void eeprom_write_sound(Sound sound, uint16_t dest) -{ - eeprom_write_word((uint16_t*)dest, sound.freq); - eeprom_write_word((uint16_t*)dest + 2, sound.durationMs); -} - /** * * @param eeprom_base start of buzz effects table */ void setDefaultBuzzEffects(uint16_t eeprom_base) { - Sound blare = {NOTE_B2, 500}; - eeprom_write_sound(blare,eeprom_base + buzz_eeprom_offsets::SOUND_ON); + eeprom_write_byte((uint8_t *)(eeprom_base + buzz_eeprom_offsets::SOUND_ON), DEFAULT_BUZZ_ON); + eeprom_write_byte((uint8_t *)(eeprom_base + buzz_eeprom_offsets::HEAT_BUZZ_OFFSET), DEFAULT_BUZZ_HEAT); } /** diff --git a/firmware/src/MightyBoard/Motherboard/Piezo.cc b/firmware/src/MightyBoard/Motherboard/Piezo.cc index 105ca883..99020dfd 100644 --- a/firmware/src/MightyBoard/Motherboard/Piezo.cc +++ b/firmware/src/MightyBoard/Motherboard/Piezo.cc @@ -72,7 +72,7 @@ static Timeout piezoTimeout; void reset(void) { // Reads the sound setting in from eeprom - soundEnabled = (bool)(eeprom::getEeprom8(eeprom_offsets::BUZZ_SETTINGS + buzz_eeprom_offsets::SOUND_ON,1) != 0); + soundEnabled = (bool)(eeprom::getEeprom8(eeprom_offsets::BUZZ_SETTINGS + buzz_eeprom_offsets::SOUND_ON, DEFAULT_BUZZ_ON) != 0); //Empty the queue tones.reset(); @@ -433,20 +433,6 @@ void playTune(uint8_t tuneid) { } -// call this sequence on startup -void startUpTone() -{ - playTune(TUNE_FILAMENT_START); -} - - -// call this sequence at the end of prints -void doneTone( )// Ta-da! -{ - playTune(TUNE_PRINT_DONE); -} - - // call this sequence on error void errorTone(uint8_t iterations) { From 11f6b2b35de5da7eb1ae45b4f5a93f2d43b8760e Mon Sep 17 00:00:00 2001 From: Alexander Thomas Date: Sat, 21 Apr 2018 22:52:24 +0200 Subject: [PATCH 3/5] =?UTF-8?q?Keep=20=E2=80=98M72=20P2=E2=80=99=20and=20a?= =?UTF-8?q?nything=20above=20P8=20the=20same=20error=20tune=20as=20before?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- firmware/src/MightyBoard/Motherboard/Piezo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firmware/src/MightyBoard/Motherboard/Piezo.cc b/firmware/src/MightyBoard/Motherboard/Piezo.cc index 99020dfd..dd24e622 100644 --- a/firmware/src/MightyBoard/Motherboard/Piezo.cc +++ b/firmware/src/MightyBoard/Motherboard/Piezo.cc @@ -429,7 +429,7 @@ void playTune(uint8_t tuneid) { } while (duration != 0 ); //duration == 0 marks the end of the tune } else - setTone(NOTE_B2, 500); //Play this is the tuneid doesn't exist + errorTone(2); //Play this if the tuneid doesn't exist } From 88a08afb5bfc94d7aa0f56d667fc0044bf814aad Mon Sep 17 00:00:00 2001 From: Alexander Thomas Date: Sun, 22 Apr 2018 23:49:48 +0200 Subject: [PATCH 4/5] Update general settings menu item count (and add a reminder) --- firmware/src/MightyBoard/shared/Menu.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/firmware/src/MightyBoard/shared/Menu.cc b/firmware/src/MightyBoard/shared/Menu.cc index 7d4fbbef..8af2445f 100644 --- a/firmware/src/MightyBoard/shared/Menu.cc +++ b/firmware/src/MightyBoard/shared/Menu.cc @@ -3857,7 +3857,7 @@ void BotStatsScreen::notifyButtonPressed(ButtonArray::ButtonName button) { SettingsMenu::SettingsMenu() : CounterMenu(_BV((uint8_t)ButtonArray::UP) | _BV((uint8_t)ButtonArray::DOWN), - (uint8_t)7 + (uint8_t)8 // number of static menu items #if EXTRUDERS > 1 + 1 #endif @@ -3933,6 +3933,7 @@ void SettingsMenu::resetState() { } void SettingsMenu::drawItem(uint8_t index, LiquidCrystalSerial& lcd) { + // When adding items, don't forget to increment the constant in SettingsMenu::SettingsMenu bool test = false; const prog_uchar *msg; uint8_t selection_column = 16; From ee97d8ae3f6f8ea4c607449afd50ddb9492d5776 Mon Sep 17 00:00:00 2001 From: Alexander Thomas Date: Sat, 5 May 2018 18:38:50 +0200 Subject: [PATCH 5/5] Only mute heater tune while printing and HEAT_BUZZ is off, play it in all other cases --- firmware/src/MightyBoard/Motherboard/EepromMap.hh | 2 +- firmware/src/MightyBoard/Motherboard/Motherboard.cc | 5 ++++- firmware/src/MightyBoard/shared/Menu.cc | 5 ----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/firmware/src/MightyBoard/Motherboard/EepromMap.hh b/firmware/src/MightyBoard/Motherboard/EepromMap.hh index 2f4683d9..9611fda8 100644 --- a/firmware/src/MightyBoard/Motherboard/EepromMap.hh +++ b/firmware/src/MightyBoard/Motherboard/EepromMap.hh @@ -655,7 +655,7 @@ namespace buzz_eeprom_offsets{ //$type:B $constraints:l,0,1 $tooltip:Check or set to 1 to play bot sounds. Uncheck or set to 0 for no sounds. const static uint16_t SOUND_ON = 0x00; //$BEGIN_ENTRY -//$type:B $constraints:l,0,1 $tooltip:Check or set to 1 to play temperatures reached tune. Uncheck or set to 0 for no tune. +//$type:B $constraints:l,0,1 $tooltip:Check or set to 1 to always play temperatures reached tune. Uncheck or set to 0 to mute the tune while printing. const static uint16_t HEAT_BUZZ_OFFSET = 0x02; //$BEGIN_ENTRY //$type:B $ignore:True $constraints:l,0,1 diff --git a/firmware/src/MightyBoard/Motherboard/Motherboard.cc b/firmware/src/MightyBoard/Motherboard/Motherboard.cc index 2c37214a..6b9469cf 100644 --- a/firmware/src/MightyBoard/Motherboard/Motherboard.cc +++ b/firmware/src/MightyBoard/Motherboard/Motherboard.cc @@ -551,8 +551,11 @@ void Motherboard::HeatingAlerts() { else { if ( heating_lights_active ) { heating_lights_active = false; + // Always play tune while not printing, only play during print if HEAT_BUZZ is on or while paused. if ( eeprom::getEeprom8(eeprom_offsets::BUZZ_SETTINGS + buzz_eeprom_offsets::HEAT_BUZZ_OFFSET, - DEFAULT_BUZZ_HEAT) ) + DEFAULT_BUZZ_HEAT) || + host::getHostState() == host::HOST_STATE_READY || + command::pauseState() == PAUSE_STATE_PAUSED ) Piezo::playTune(TUNE_FILAMENT_START); #ifdef HAS_RGB_LED RGB_LED::setDefaultColor(); diff --git a/firmware/src/MightyBoard/shared/Menu.cc b/firmware/src/MightyBoard/shared/Menu.cc index 8af2445f..ab137698 100644 --- a/firmware/src/MightyBoard/shared/Menu.cc +++ b/firmware/src/MightyBoard/shared/Menu.cc @@ -621,11 +621,6 @@ void SelectAlignmentMenu::handleSelect(uint8_t index) { #endif // !SINGLE_EXTRUDER void FilamentScreen::startMotor(){ - // If the general heater tune is disabled, do play filament loading tune here. - if ( ! eeprom::getEeprom8(eeprom_offsets::BUZZ_SETTINGS + buzz_eeprom_offsets::HEAT_BUZZ_OFFSET, - DEFAULT_BUZZ_HEAT) ) - Piezo::playTune(TUNE_FILAMENT_START); - //So we don't prime after a pause command::pauseUnRetractClear();