From 8d162e5bd75ef221dc79a5cf79f9db3185345591 Mon Sep 17 00:00:00 2001 From: Ronald Date: Mon, 3 Feb 2014 07:45:03 +0000 Subject: [PATCH 1/2] Improved support for panelolu2 encoder and buzzer I added #define for LCD_FEEDBACK_FREQUENCY_HZ and LCD_FEEDBACK_FREQUENCY_DURATION_MS which is used to alter the default buzzer sound. When selecting Panelolu2 in configuration.h: - it automatically sets the correct ENCODER_PULSES_PER_STEP and ENCODER_STEPS_PER_MENU_ITEM. - if LCD_USE_I2C_BUZZER is defined it will also set the default LCD_FEEDBACK_FREQUENCY_HZ and LCD_FEEDBACK_FREQUENCY_DURATION_MS When selecting the sanguinololu 1284p the following is true: - its now enables LARGE_FLASH - It enables the gcode M300 when the panelolu2 LCD_USE_I2C_BUZZER is defined --- Marlin/Configuration.h | 17 +++++++++++++++++ Marlin/Marlin_main.cpp | 12 +++++++++--- Marlin/pins.h | 4 ++++ .../ultralcd_implementation_hitachi_HD44780.h | 6 +++++- 4 files changed, 35 insertions(+), 4 deletions(-) diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 1da62fc2ad..1dd76d4116 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -447,6 +447,8 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of //#define ENCODER_STEPS_PER_MENU_ITEM 5 // Set according to ENCODER_PULSES_PER_STEP or your liking //#define ULTIMAKERCONTROLLER //as available from the ultimaker online store. //#define ULTIPANEL //the ultipanel as on thingiverse +//#define LCD_FEEDBACK_FREQUENCY_HZ 1000 // this is the tone frequency the buzzer plays when on UI feedback. ie Screen Click +//#define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 // the duration the buzzer plays the UI feedback sound. ie Screen Click // The MaKr3d Makr-Panel with graphic controller and SD support // http://reprap.org/wiki/MaKr3d_MaKrPanel @@ -532,6 +534,21 @@ const bool Z_MAX_ENDSTOP_INVERTING = true; // set to true to invert the logic of #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD #define NEWPANEL #define ULTIPANEL + + #ifndef ENCODER_PULSES_PER_STEP + #define ENCODER_PULSES_PER_STEP 4 + #endif + + #ifndef ENCODER_STEPS_PER_MENU_ITEM + #define ENCODER_STEPS_PER_MENU_ITEM 1 + #endif + + + #ifdef LCD_USE_I2C_BUZZER + #define LCD_FEEDBACK_FREQUENCY_HZ 1000 + #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 100 + #endif + #endif // Panucatt VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index b5e4e85193..cc0c64a1f1 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2466,7 +2466,7 @@ void process_commands() break; #endif // NUM_SERVOS > 0 - #if LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) ) + #if (LARGE_FLASH == true && ( BEEPER > 0 || defined(ULTRALCD) || defined(LCD_USE_I2C_BUZZER))) case 300: // M300 { int beepS = code_seen('S') ? code_value() : 110; @@ -2478,7 +2478,9 @@ void process_commands() delay(beepP); noTone(BEEPER); #elif defined(ULTRALCD) - lcd_buzz(beepS, beepP); + lcd_buzz(beepS, beepP); + #elif defined(LCD_USE_I2C_BUZZER) + lcd_buzz(beepP, beepS); #endif } else @@ -2736,7 +2738,11 @@ void process_commands() WRITE(BEEPER,LOW); delay(3); #else - lcd_buzz(1000/6,100); + #if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS) + lcd_buzz(1000/6,100); + #else + lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS,LCD_FEEDBACK_FREQUENCY_HZ); + #endif #endif } } diff --git a/Marlin/pins.h b/Marlin/pins.h index d896bca2eb..1576d529bb 100644 --- a/Marlin/pins.h +++ b/Marlin/pins.h @@ -971,6 +971,10 @@ #undef MOTHERBOARD #define MOTHERBOARD 6 #define SANGUINOLOLU_V_1_2 + +#if defined(__AVR_ATmega1284P__) + #define LARGE_FLASH true +#endif #endif #if MOTHERBOARD == 6 #define KNOWN_BOARD 1 diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index c0d4989c3b..afc9c5c476 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -711,7 +711,11 @@ static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pst static void lcd_implementation_quick_feedback() { #ifdef LCD_USE_I2C_BUZZER - lcd.buzz(60,1000/6); + #if !defined(LCD_FEEDBACK_FREQUENCY_HZ) || !defined(LCD_FEEDBACK_FREQUENCY_DURATION_MS) + lcd_buzz(1000/6,100); + #else + lcd_buzz(LCD_FEEDBACK_FREQUENCY_DURATION_MS,LCD_FEEDBACK_FREQUENCY_HZ); + #endif #elif defined(BEEPER) && BEEPER > -1 SET_OUTPUT(BEEPER); for(int8_t i=0;i<10;i++) From c2b3e88787c00476d00ec897d9337d80183d93f8 Mon Sep 17 00:00:00 2001 From: Ronald Date: Mon, 3 Feb 2014 15:35:23 +0000 Subject: [PATCH 2/2] Changed 1284p fuse setting for Arduino_1.x.x - Remove the two version of 16mHz. Crystal and resonator use the same fuse setting. Also, Arduino IDE only showed the first one 16Mhz as a board option. - Added 20Mhz board option. Symptoms for incorrect fuse setting: - X axis move in one direction - limit switches fail to trigger - unable to reprogram the device via bootloader - stops working when the reset switch is pressed. - device fails to bootup when power by a slow raise power supply. Solution: - Disabled the jtag - set the correct clock selection bit - set the correct bootloader memory size - enable brown-out setting - enable clock power up delay --- .../hardware/Sanguino/boards.txt | 44 +++++++++---------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/boards.txt b/ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/boards.txt index c1a1f08ab6..2bec14eab3 100644 --- a/ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/boards.txt +++ b/ArduinoAddons/Arduino_1.x.x/hardware/Sanguino/boards.txt @@ -27,9 +27,9 @@ atmega12848m.upload.protocol=stk500 atmega12848m.upload.maximum_size=131072 atmega12848m.upload.speed=19200 -atmega12848m.bootloader.low_fuses=0xFD -atmega12848m.bootloader.high_fuses=0x9A -atmega12848m.bootloader.extended_fuses=0xFF +atmega1284.bootloader.low_fuses=0xD6 +atmega1284.bootloader.high_fuses=0xDA +atmega1284.bootloader.extended_fuses=0xFD atmega12848m.bootloader.path=atmega atmega12848m.bootloader.file=ATmegaBOOT_168_atmega1284p_8m.hex atmega12848m.bootloader.unlock_bits=0x3F @@ -48,9 +48,9 @@ atmega1284.upload.protocol=stk500 atmega1284.upload.maximum_size=131072 atmega1284.upload.speed=57600 -atmega1284.bootloader.low_fuses=0xFF -atmega1284.bootloader.high_fuses=0x9A -atmega1284.bootloader.extended_fuses=0xFF +atmega1284.bootloader.low_fuses=0xD6 +atmega1284.bootloader.high_fuses=0xDA +atmega1284.bootloader.extended_fuses=0xFD atmega1284.bootloader.path=atmega atmega1284.bootloader.file=ATmegaBOOT_168_atmega1284p.hex atmega1284.bootloader.unlock_bits=0x3F @@ -60,26 +60,24 @@ atmega1284.build.mcu=atmega1284p atmega1284.build.f_cpu=16000000L atmega1284.build.core=arduino atmega1284.build.variant=standard -# - ############################################################## -atmega1284.name=Sanguino W/ ATmega1284p 16mhz ceramic resonator +atmega1284m.name=Sanguino W/ ATmega1284p 20mhz -atmega1284.upload.protocol=stk500 -atmega1284.upload.maximum_size=131072 -atmega1284.upload.speed=57600 +atmega1284m.upload.protocol=stk500 +atmega1284m.upload.maximum_size=131072 +atmega1284m.upload.speed=57600 -atmega1284.bootloader.low_fuses=0xD6 -atmega1284.bootloader.high_fuses=0xDC -atmega1284.bootloader.extended_fuses=0xFD -atmega1284.bootloader.path=atmega -atmega1284.bootloader.file=ATmegaBOOT_168_atmega1284p.hex -atmega1284.bootloader.unlock_bits=0x3F -atmega1284.bootloader.lock_bits=0x0F +atmega1284m.bootloader.low_fuses=0xD6 +atmega1284m.bootloader.high_fuses=0xDA +atmega1284m.bootloader.extended_fuses=0xFD +atmega1284m.bootloader.path=atmega +atmega1284m.bootloader.file=ATmegaBOOT_168_atmega1284p.hex +atmega1284m.bootloader.unlock_bits=0x3F +atmega1284m.bootloader.lock_bits=0x0F -atmega1284.build.mcu=atmega1284p -atmega1284.build.f_cpu=16000000L -atmega1284.build.core=arduino -atmega1284.build.variant=standard +atmega1284m.build.mcu=atmega1284p +atmega1284m.build.f_cpu=20000000L +atmega1284m.build.core=arduino +atmega1284m.build.variant=standard #