Skip to content

Commit

Permalink
SkyNet3D - Anet Printer software changes
Browse files Browse the repository at this point in the history
Changed Anet button detection ranges and resolution.

Updated ANet 5 Button LCD implementaiton to newer Marlin

Improved 5 button display (value editing with acceleration)

Right button now either resets values to 0 or returns to status menu

Changes to support RepRap Discount Full Graphics Display:
See http://www.thingiverse.com/thing:2103748 for wiring!

BLTouch / 3D-Touch Pins for Anet A8/A6 Board and Displays:
- Pin 27 (wire 3 counting from red) for 5 Button and RepRap Discount
- Pin 29 (wire 7 counting from red) for A6 Displays
  • Loading branch information
oderwat committed Jun 4, 2017
1 parent af4aa87 commit 4648823
Show file tree
Hide file tree
Showing 10 changed files with 298 additions and 12 deletions.
11 changes: 10 additions & 1 deletion Marlin/Conditionals_LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@
#define DEFAULT_LCD_CONTRAST 17
#endif

#if ENABLED(ANET_KEYPAD_LCD)
#define REPRAPWORLD_KEYPAD
#define REPRAPWORLD_KEYPAD_MOVE_STEP 10.0
#define ADC_KEYPAD
// this helps to implement ADC_KEYPAD menus
#define ENCODER_STEPS_PER_MENU_ITEM 1
#define REVERSE_MENU_DIRECTION
#endif

#if ENABLED(miniVIKI) || ENABLED(VIKI2) || ENABLED(ELB_FULL_GRAPHIC_CONTROLLER)
#define ULTRA_LCD //general LCD support, also 16x2
#define DOGLCD // Support for SPI LCD 128x64 (Controller ST7565R graphic Display Family)
Expand Down Expand Up @@ -92,7 +101,7 @@
#endif
#endif

#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) || ENABLED(ANET_FULL_GRAPHICS_LCD)
#define DOGLCD
#define U8GLIB_ST7920
#define REPRAP_DISCOUNT_SMART_CONTROLLER
Expand Down
1 change: 1 addition & 0 deletions Marlin/boards.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#define BOARD_MELZI_MAKR3D 66 // Melzi with ATmega1284 (MaKr3d version)
#define BOARD_AZTEEG_X3 67 // Azteeg X3
#define BOARD_AZTEEG_X3_PRO 68 // Azteeg X3 Pro
#define BOARD_ANET_10 69 // Anet 1.0 (Melzi clone)
#define BOARD_ULTIMAKER 7 // Ultimaker
#define BOARD_ULTIMAKER_OLD 71 // Ultimaker (Older electronics. Pre 1.5.4. This is rare)
#define BOARD_ULTIMAIN_2 72 // Ultimainboard 2.x (Uses TEMP_SENSOR 20)
Expand Down
1 change: 1 addition & 0 deletions Marlin/enum.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,4 @@ enum LCDViewAction {
#endif

#endif // __ENUM_H__

2 changes: 2 additions & 0 deletions Marlin/pins.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@
#include "pins_AZTEEG_X3.h"
#elif MB(AZTEEG_X3_PRO)
#include "pins_AZTEEG_X3_PRO.h"
#elif MB(ANET_10)
#include "pins_ANET_10.h"
#elif MB(ULTIMAKER)
#include "pins_ULTIMAKER.h"
#elif MB(ULTIMAKER_OLD)
Expand Down
106 changes: 106 additions & 0 deletions Marlin/pins_ANET_10.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* Anet board pin assignments
*/

#if defined(__AVR_ATmega1284P__)
#define VARIANT_STANDARD true
#endif

#include "pins_SANGUINOLOLU_12.h"

#undef BOARD_NAME
#define BOARD_NAME "Anet"

#undef LED_PIN
#undef FAN_PIN

#define LED_PIN -1
#define FAN_PIN 4

#if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)
#undef LCD_PINS_RS
#undef LCD_PINS_ENABLE
#undef LCD_PINS_D4
#undef LCD_PINS_D5
#undef LCD_PINS_D6
#undef LCD_PINS_D7

#if ENABLED(ADC_KEYPAD)
#undef BTN_EN1
#undef BTN_EN2
#undef BTN_ENC

#define SERVO0_PIN 27 // free for BLTouch/3D-Touch
#define LCD_PINS_RS 28
#define LCD_PINS_ENABLE 29
#define LCD_PINS_D4 10
#define LCD_PINS_D5 11
#define LCD_PINS_D6 16
#define LCD_PINS_D7 17

#define BTN_EN1 -1
#define BTN_EN2 -1
#define BTN_ENC -1

#define ADC_KEYPAD_PIN 1

#define ENCODER_FEEDRATE_DEADZONE 2
#elif ENABLED(U8GLIB_ST7920)
#undef BEEPER_PIN

#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
// For RepRap Discount (with Anet Adapter wiring)
#define SERVO0_PIN 27 // free for BLTouch/3D-Touch
#define BEEPER_PIN 28
#define LCD_PINS_RS 30
#define LCD_PINS_ENABLE 29
#define LCD_PINS_D4 17
#define BTN_EN1 11
#define BTN_EN2 10
#elif ENABLED(ANET_FULL_GRAPHICS_LCD)
#define SERVO0_PIN 29 // free for BLTouch/3D-Touch
#define BEEPER_PIN 17
#define LCD_PINS_RS 27
#define LCD_PINS_ENABLE 28
#define LCD_PINS_D4 30
#else
#error "You need to select ANET or RepRap Version"
#endif

#define ST7920_DELAY_1 DELAY_0_NOP
#define ST7920_DELAY_2 DELAY_1_NOP
#define ST7920_DELAY_3 DELAY_2_NOP

#ifndef ENCODER_STEPS_PER_MENU_ITEM
#define ENCODER_STEPS_PER_MENU_ITEM 1
#endif
#ifndef ENCODER_PULSES_PER_STEP
#define ENCODER_PULSES_PER_STEP 4
#endif
#endif

#endif


2 changes: 1 addition & 1 deletion Marlin/pins_SANGUINOLOLU_11.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
#define BOARD_NAME "Sanguinololu <1.2"
#endif

#define IS_MELZI (MB(MELZI) || MB(MELZI_MAKR3D))
#define IS_MELZI (MB(MELZI) || MB(MELZI_MAKR3D) || MB(ANET_10))

//
// Limit Switches
Expand Down
29 changes: 29 additions & 0 deletions Marlin/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ uint8_t Temperature::soft_pwm_amount[HOTENDS],
#endif
#endif

#if ENABLED(ADC_KEYPAD)
uint32_t Temperature::current_ADCKey_raw = 0;
uint8_t Temperature::ADCKey_count = 0;
#endif

#if HAS_PID_HEATING

void Temperature::PID_autotune(float temp, int hotend, int ncycles, bool set_result/*=false*/) {
Expand Down Expand Up @@ -1629,6 +1634,9 @@ void Temperature::isr() {
static uint8_t pwm_count = _BV(SOFT_PWM_SCALE);
// avoid multiple loads of pwm_count
uint8_t pwm_count_tmp = pwm_count;
#if ENABLED(ADC_KEYPAD)
static unsigned int raw_ADCKey_value = 0;
#endif

// Static members for each heater
#if ENABLED(SLOW_PWM_HEATERS)
Expand Down Expand Up @@ -2001,6 +2009,27 @@ void Temperature::isr() {
raw_filwidth_value -= (raw_filwidth_value >> 7); // Subtract 1/128th of the raw_filwidth_value
raw_filwidth_value += ((unsigned long)ADC << 7); // Add new ADC reading, scaled by 128
}
break;
#endif

#if ENABLED(ADC_KEYPAD)
case Prepare_ADC_KEY:
START_ADC(ADC_KEYPAD_PIN);
break;

case Measure_ADC_KEY:
if (ADCKey_count < 16) {
raw_ADCKey_value = ADC;
if (raw_ADCKey_value > 900) {
//ADC Key release
ADCKey_count = 0;
current_ADCKey_raw = 0;
}
else {
current_ADCKey_raw += raw_ADCKey_value;
ADCKey_count++;
}
}
break;
#endif

Expand Down
8 changes: 8 additions & 0 deletions Marlin/temperature.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ enum ADCSensorState {
Prepare_FILWIDTH,
Measure_FILWIDTH,
#endif
#if ENABLED(ADC_KEYPAD)
Prepare_ADC_KEY,
Measure_ADC_KEY,
#endif
SensorsReady, // Temperatures ready. Delay the next round of readings to let ADC pins settle.
StartupDelay // Startup, delay initial temp reading a tiny bit so the hardware can settle
};
Expand Down Expand Up @@ -276,6 +280,10 @@ class Temperature {
#endif

public:
#if ENABLED(ADC_KEYPAD)
static uint32_t current_ADCKey_raw;
static uint8_t ADCKey_count;
#endif

/**
* Instance Methods
Expand Down
Loading

0 comments on commit 4648823

Please sign in to comment.