├── MK ├── sd_card_menu │ ├── Menu │ │ ├── Prepare │ │ │ ├── Level_Bed.g │ │ │ ├── Power │ │ │ │ ├── Power_ON.g │ │ │ │ └── Power_OFF.g │ │ │ ├── Diable_Steppers.g │ │ │ ├── EEPROM │ │ │ │ ├── EEPROM_Load.g │ │ │ │ ├── EEPROM_Save.g │ │ │ │ ├── Load_Default.g │ │ │ │ └── Print_Settings.g │ │ │ ├── Endstops │ │ │ │ ├── Diable.g │ │ │ │ ├── Enable.g │ │ │ │ └── Print.g │ │ │ ├── Homing │ │ │ │ ├── Auto_Home.g │ │ │ │ ├── Home_X.g │ │ │ │ ├── Home_XY.g │ │ │ │ ├── Home_Z.g │ │ │ │ └── Home_Y.g │ │ │ ├── ZERO_here.g │ │ │ ├── Cooldown.g │ │ │ ├── Preheat_ABS │ │ │ │ ├── Bed.g │ │ │ │ ├── Extruder.g │ │ │ │ └── All.g │ │ │ ├── Preheat_PLA │ │ │ │ ├── Bed.g │ │ │ │ ├── Extruder.g │ │ │ │ └── All.g │ │ │ ├── Move │ │ │ │ └── Go_ZERO.g │ │ │ └── Move_Axis │ │ │ │ ├── Change E │ │ │ │ ├── Exrtuder_0.g │ │ │ │ ├── Exrtuder_1.g │ │ │ │ ├── Exrtuder_2.g │ │ │ │ ├── Exrtuder_3.g │ │ │ │ └── Exrtuder_4.g │ │ │ │ ├── Move E │ │ │ │ ├── Minus │ │ │ │ │ ├── minus_1mm.g │ │ │ │ │ ├── minus_0.01mm.g │ │ │ │ │ ├── minus_0.1mm.g │ │ │ │ │ ├── minus_100mm.g │ │ │ │ │ └── minus_10mm.g │ │ │ │ └── Plus │ │ │ │ │ ├── plus_0_1mm.g │ │ │ │ │ ├── plus_100mm.g │ │ │ │ │ ├── plus_10mm.g │ │ │ │ │ ├── plus_1mm.g │ │ │ │ │ └── plus_0.01mm.g │ │ │ │ ├── Move X │ │ │ │ ├── Plus │ │ │ │ │ ├── plus_1mm.g │ │ │ │ │ ├── plus_0.01mm.g │ │ │ │ │ ├── plus_0_1mm.g │ │ │ │ │ ├── plus_100mm.g │ │ │ │ │ └── plus_10mm.g │ │ │ │ └── Minus │ │ │ │ │ ├── minus_10mm.g │ │ │ │ │ ├── minus_1mm.g │ │ │ │ │ ├── minus_0.01mm.g │ │ │ │ │ ├── minus_0.1mm.g │ │ │ │ │ └── minus_100mm.g │ │ │ │ ├── Move Y │ │ │ │ ├── Plus │ │ │ │ │ ├── plus_1mm.g │ │ │ │ │ ├── plus_0.01mm.g │ │ │ │ │ ├── plus_0_1mm.g │ │ │ │ │ ├── plus_100mm.g │ │ │ │ │ └── plus_10mm.g │ │ │ │ └── Minus │ │ │ │ │ ├── minus_10mm.g │ │ │ │ │ ├── minus_1mm.g │ │ │ │ │ ├── minus_0.01mm.g │ │ │ │ │ ├── minus_0.1mm.g │ │ │ │ │ └── minus_100mm.g │ │ │ │ └── Move Z │ │ │ │ ├── Plus │ │ │ │ ├── plus_1mm.g │ │ │ │ ├── plus_0.01mm.g │ │ │ │ ├── plus_0_1mm.g │ │ │ │ ├── plus_100mm.g │ │ │ │ └── plus_10mm.g │ │ │ │ └── Minus │ │ │ │ ├── minus_10mm.g │ │ │ │ ├── minus_1mm.g │ │ │ │ ├── minus_0.01mm.g │ │ │ │ ├── minus_0.1mm.g │ │ │ │ └── minus_100mm.g │ │ ├── Control │ │ │ ├── Filament │ │ │ │ ├── Set_3mm.g │ │ │ │ └── Set_1_75mm.g │ │ │ └── Temperature │ │ │ │ ├── Bed │ │ │ │ ├── 50.g │ │ │ │ ├── 55.g │ │ │ │ ├── 60.g │ │ │ │ ├── 65.g │ │ │ │ ├── 70.g │ │ │ │ ├── 75.g │ │ │ │ ├── 80.g │ │ │ │ ├── 85.g │ │ │ │ ├── 90.g │ │ │ │ ├── 100.g │ │ │ │ ├── 105.g │ │ │ │ ├── 110.g │ │ │ │ ├── 115.g │ │ │ │ ├── 120.g │ │ │ │ └── 95.g │ │ │ │ ├── Fan │ │ │ │ ├── Fan_100.g │ │ │ │ ├── Fan_50.g │ │ │ │ ├── Fan_Off.g │ │ │ │ ├── Fan_25.g │ │ │ │ ├── Fan_33.g │ │ │ │ ├── Fan_66.g │ │ │ │ ├── Fan_75.g │ │ │ │ └── Fan_On.g │ │ │ │ └── Nozzle │ │ │ │ ├── 220.g │ │ │ │ ├── 221.g │ │ │ │ ├── 222.g │ │ │ │ ├── 223.g │ │ │ │ ├── 224.g │ │ │ │ ├── 226.g │ │ │ │ ├── 227.g │ │ │ │ ├── 228.g │ │ │ │ ├── 229.g │ │ │ │ ├── 230.g │ │ │ │ └── 225.g │ │ ├── subtest.g │ │ └── pausetest.g │ ├── Readme.txt │ └── Music │ │ └── imperial_march.gcode ├── fonts │ ├── HD44780_C.fon │ ├── HD44780_J.fon │ ├── HD44780_W.fon │ ├── bdf2u8g.exe │ ├── ISO10646-1.fon │ ├── ISO10646_CN.fon │ ├── ISO10646_Kana.fon │ ├── Marlin_symbols.fon │ ├── ISO10646-5_Cyrillic.fon │ ├── make_fonts.bat │ └── README.fonts ├── Configuration_Temperature.h ├── Nextion FW │ ├── mk4duo_v0_8_8.HMI │ └── mk4duo_v0_8_8.tft ├── Configuration_Overall.h ├── src │ ├── nextion │ │ └── nextion_lib │ │ │ ├── NexHotspot.cpp │ │ │ ├── NexObject.cpp │ │ │ ├── NexPage.cpp │ │ │ ├── NexConfig.h │ │ │ ├── NexHotspot.h │ │ │ ├── NexPage.h │ │ │ ├── Nextion.h │ │ │ ├── NexCrop.cpp │ │ │ ├── NexHardware.h │ │ │ ├── NexVariable.cpp │ │ │ ├── NexObject.h │ │ │ ├── NexCrop.h │ │ │ ├── NexPicture.cpp │ │ │ ├── NexTouch.cpp │ │ │ ├── NexPicture.h │ │ │ ├── NexVariable.h │ │ │ ├── NexRadio.cpp │ │ │ ├── NexCheckbox.cpp │ │ │ ├── NexProgressBar.h │ │ │ ├── NexProgressBar.cpp │ │ │ ├── NexRadio.h │ │ │ ├── NexCheckbox.h │ │ │ ├── NexTimer.cpp │ │ │ └── NexTimer.h │ ├── fwtest │ │ └── firmware_test.h │ ├── types.h │ ├── lcd │ │ ├── buzzer.h │ │ ├── dogm_font_data_Marlin_symbols.h │ │ ├── buzzer.cpp │ │ └── utility.h │ ├── blinkm │ │ ├── blinkm.h │ │ └── blinkm.cpp │ ├── mbl │ │ └── mesh_bed_leveling.cpp │ ├── mechanics.h │ ├── digipot │ │ ├── digipot_mcp4451.h │ │ └── digipot_mcp4451.cpp │ ├── boards │ │ ├── 99.h │ │ ├── 4.h │ │ ├── 9.h │ │ ├── 13.h │ │ ├── 408.h │ │ ├── 82.h │ │ ├── 22.h │ │ ├── 71.h │ │ ├── 20.h │ │ ├── 316.h │ │ ├── 11.h │ │ ├── 12.h │ │ ├── 433.h │ │ ├── 2.h │ │ ├── 5.h │ │ ├── 88.h │ │ ├── 702.h │ │ ├── 3.h │ │ ├── 999.h │ │ ├── 72.h │ │ ├── 8.h │ │ ├── 10.h │ │ ├── 70.h │ │ ├── 83.h │ │ ├── 705.h │ │ ├── 7.h │ │ └── 90.h │ ├── sensor │ │ ├── flowmeter.h │ │ └── flowmeter.cpp │ ├── watchdog │ │ ├── watchdog.h │ │ └── watchdog.cpp │ ├── planner │ │ ├── qr_solve.h │ │ └── vector_3.h │ ├── endstop │ │ └── endstops.h │ ├── printcounter │ │ └── stopwatch.cpp │ ├── temperature │ │ └── thermistornames.h │ └── HAL │ │ └── HAL.cpp ├── Configuration_Version.h ├── scripts │ └── create_speed_lookuptable.py ├── base.h └── Configuration_Store.h ├── .gitignore ├── Documentation ├── Laser │ ├── wiring_diagram.jpg │ ├── README.md │ └── K40_ramps_configs │ │ ├── K40_no_cooler_no_flowmeter │ │ └── Configuration_Laser.h │ │ └── K40_with_cooler_and_flowmeter │ │ └── Configuration_Laser.h ├── [need update]Menu Plans.xlsx ├── [need update]LCD Menu Tree.pdf ├── Logo │ └── MarlinKimbra Logo GitHub.png ├── RampsServoPower.md ├── Compilation.md ├── FilamentSensor.md └── CurrentSensor.md ├── .gitattributes └── README.md /MK/sd_card_menu/Menu/Prepare/Level_Bed.g: -------------------------------------------------------------------------------- 1 | G29 -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Power/Power_ON.g: -------------------------------------------------------------------------------- 1 | M80 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Diable_Steppers.g: -------------------------------------------------------------------------------- 1 | M18 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/EEPROM/EEPROM_Load.g: -------------------------------------------------------------------------------- 1 | M500 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/EEPROM/EEPROM_Save.g: -------------------------------------------------------------------------------- 1 | M500 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Endstops/Diable.g: -------------------------------------------------------------------------------- 1 | M121 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Endstops/Enable.g: -------------------------------------------------------------------------------- 1 | M120 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Endstops/Print.g: -------------------------------------------------------------------------------- 1 | M119 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Homing/Auto_Home.g: -------------------------------------------------------------------------------- 1 | G28 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Homing/Home_X.g: -------------------------------------------------------------------------------- 1 | G28 X 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Homing/Home_XY.g: -------------------------------------------------------------------------------- 1 | G28 XY 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Homing/Home_Z.g: -------------------------------------------------------------------------------- 1 | G28 Z 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Power/Power_OFF.g: -------------------------------------------------------------------------------- 1 | M81 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/ZERO_here.g: -------------------------------------------------------------------------------- 1 | G92 X0 Z0 Y0 E0 -------------------------------------------------------------------------------- /MK/sd_card_menu/Readme.txt: -------------------------------------------------------------------------------- 1 | Copy folder Menu in sd card. -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Filament/Set_3mm.g: -------------------------------------------------------------------------------- 1 | M404 N3 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/50.g: -------------------------------------------------------------------------------- 1 | M140 S50 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/55.g: -------------------------------------------------------------------------------- 1 | M140 S55 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/60.g: -------------------------------------------------------------------------------- 1 | M140 S60 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/65.g: -------------------------------------------------------------------------------- 1 | M140 S65 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/70.g: -------------------------------------------------------------------------------- 1 | M140 S70 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/75.g: -------------------------------------------------------------------------------- 1 | M140 S75 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/80.g: -------------------------------------------------------------------------------- 1 | M140 S80 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/85.g: -------------------------------------------------------------------------------- 1 | M140 S85 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/90.g: -------------------------------------------------------------------------------- 1 | M140 S90 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Fan/Fan_100.g: -------------------------------------------------------------------------------- 1 | M106 S255 -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Fan/Fan_50.g: -------------------------------------------------------------------------------- 1 | M106 S127 -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Fan/Fan_Off.g: -------------------------------------------------------------------------------- 1 | M107 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Cooldown.g: -------------------------------------------------------------------------------- 1 | M104 S0 2 | M140 S0 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/EEPROM/Load_Default.g: -------------------------------------------------------------------------------- 1 | M502 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/EEPROM/Print_Settings.g: -------------------------------------------------------------------------------- 1 | M503 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Homing/Home_Y.g: -------------------------------------------------------------------------------- 1 | G28 Y 2 | 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Preheat_ABS/Bed.g: -------------------------------------------------------------------------------- 1 | M140 S90 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Preheat_PLA/Bed.g: -------------------------------------------------------------------------------- 1 | M140 S55 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | applet/ 3 | *~ 4 | *.orig 5 | *.rej 6 | *.bak -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Filament/Set_1_75mm.g: -------------------------------------------------------------------------------- 1 | M404 N1.75 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/100.g: -------------------------------------------------------------------------------- 1 | M140 S100 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/105.g: -------------------------------------------------------------------------------- 1 | M140 S105 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/110.g: -------------------------------------------------------------------------------- 1 | M140 S110 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/115.g: -------------------------------------------------------------------------------- 1 | M140 S115 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/120.g: -------------------------------------------------------------------------------- 1 | M140 S120 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Bed/95.g: -------------------------------------------------------------------------------- 1 | M140 S95 2 | 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Fan/Fan_25.g: -------------------------------------------------------------------------------- 1 | M106 S64 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Fan/Fan_33.g: -------------------------------------------------------------------------------- 1 | M106 S85 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Fan/Fan_66.g: -------------------------------------------------------------------------------- 1 | M106 S170 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Fan/Fan_75.g: -------------------------------------------------------------------------------- 1 | M106 S189 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Fan/Fan_On.g: -------------------------------------------------------------------------------- 1 | M106 S255 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Nozzle/220.g: -------------------------------------------------------------------------------- 1 | M104 S220 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Nozzle/221.g: -------------------------------------------------------------------------------- 1 | M104 S221 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Nozzle/222.g: -------------------------------------------------------------------------------- 1 | M104 S222 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Nozzle/223.g: -------------------------------------------------------------------------------- 1 | M104 S223 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Nozzle/224.g: -------------------------------------------------------------------------------- 1 | M104 S224 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Nozzle/226.g: -------------------------------------------------------------------------------- 1 | M104 S226 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Nozzle/227.g: -------------------------------------------------------------------------------- 1 | M104 S227 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Nozzle/228.g: -------------------------------------------------------------------------------- 1 | M104 S228 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Nozzle/229.g: -------------------------------------------------------------------------------- 1 | M104 S229 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Nozzle/230.g: -------------------------------------------------------------------------------- 1 | M104 S230 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move/Go_ZERO.g: -------------------------------------------------------------------------------- 1 | G90 2 | G0 X0 Y0 Z0 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Change E/Exrtuder_0.g: -------------------------------------------------------------------------------- 1 | T0 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Change E/Exrtuder_1.g: -------------------------------------------------------------------------------- 1 | T1 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Change E/Exrtuder_2.g: -------------------------------------------------------------------------------- 1 | T2 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Change E/Exrtuder_3.g: -------------------------------------------------------------------------------- 1 | T3 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Change E/Exrtuder_4.g: -------------------------------------------------------------------------------- 1 | T4 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Preheat_ABS/Extruder.g: -------------------------------------------------------------------------------- 1 | M104 S190 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Preheat_PLA/Extruder.g: -------------------------------------------------------------------------------- 1 | M104 S170 2 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Control/Temperature/Nozzle/225.g: -------------------------------------------------------------------------------- 1 | M104 S225 2 | 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Preheat_ABS/All.g: -------------------------------------------------------------------------------- 1 | M104 S190 2 | M140 S90 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Preheat_PLA/All.g: -------------------------------------------------------------------------------- 1 | M104 S170 2 | M140 S55 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/subtest.g: -------------------------------------------------------------------------------- 1 | G28 2 | M23 Menu/Prepare/Level_Bed.g 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/pausetest.g: -------------------------------------------------------------------------------- 1 | M117 Test1 2 | M117 Test1 3 | M0 4 | M117 Test2 5 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move E/Minus/minus_1mm.g: -------------------------------------------------------------------------------- 1 | M83 ;relative 2 | G0 E-1 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move E/Plus/plus_0_1mm.g: -------------------------------------------------------------------------------- 1 | M83 ;relative 2 | G0 E0.1 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move E/Plus/plus_100mm.g: -------------------------------------------------------------------------------- 1 | M83 ;relative 2 | G0 E100 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move E/Plus/plus_10mm.g: -------------------------------------------------------------------------------- 1 | M83 ;relative 2 | G0 E10 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move E/Plus/plus_1mm.g: -------------------------------------------------------------------------------- 1 | M83 ;relative 2 | G0 E1 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move E/Minus/minus_0.01mm.g: -------------------------------------------------------------------------------- 1 | M83 ;relative 2 | G0 E-0.01 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move E/Minus/minus_0.1mm.g: -------------------------------------------------------------------------------- 1 | M83 ;relative 2 | G0 E-0.1 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move E/Minus/minus_100mm.g: -------------------------------------------------------------------------------- 1 | M83 ;relative 2 | G0 E-100 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move E/Minus/minus_10mm.g: -------------------------------------------------------------------------------- 1 | M83 ;relative 2 | G0 E-10 3 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move E/Plus/plus_0.01mm.g: -------------------------------------------------------------------------------- 1 | M83 ;relative 2 | G0 E0.01 3 | -------------------------------------------------------------------------------- /MK/fonts/HD44780_C.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/MK/fonts/HD44780_C.fon -------------------------------------------------------------------------------- /MK/fonts/HD44780_J.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/MK/fonts/HD44780_J.fon -------------------------------------------------------------------------------- /MK/fonts/HD44780_W.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/MK/fonts/HD44780_W.fon -------------------------------------------------------------------------------- /MK/fonts/bdf2u8g.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/MK/fonts/bdf2u8g.exe -------------------------------------------------------------------------------- /MK/fonts/ISO10646-1.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/MK/fonts/ISO10646-1.fon -------------------------------------------------------------------------------- /MK/fonts/ISO10646_CN.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/MK/fonts/ISO10646_CN.fon -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move X/Plus/plus_1mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 X1 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Y/Plus/plus_1mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Y1 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Z/Plus/plus_1mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Z1 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/fonts/ISO10646_Kana.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/MK/fonts/ISO10646_Kana.fon -------------------------------------------------------------------------------- /MK/fonts/Marlin_symbols.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/MK/fonts/Marlin_symbols.fon -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move X/Minus/minus_10mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 X-10 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move X/Minus/minus_1mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 X-1 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move X/Plus/plus_0.01mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 X0.01 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move X/Plus/plus_0_1mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 X0.1 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move X/Plus/plus_100mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 X100 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move X/Plus/plus_10mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 X10 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Y/Minus/minus_10mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Y-10 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Y/Minus/minus_1mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Y-1 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Y/Plus/plus_0.01mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Y0.01 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Y/Plus/plus_0_1mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Y0.1 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Y/Plus/plus_100mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Y100 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Y/Plus/plus_10mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Y10 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Z/Minus/minus_10mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Z-10 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Z/Minus/minus_1mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Z-1 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Z/Plus/plus_0.01mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Z0.01 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Z/Plus/plus_0_1mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Z0.1 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Z/Plus/plus_100mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Z100 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Z/Plus/plus_10mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Z10 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move X/Minus/minus_0.01mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 X-0.01 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move X/Minus/minus_0.1mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 X-0.1 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move X/Minus/minus_100mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 X-100 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Y/Minus/minus_0.01mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Y-0.01 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Y/Minus/minus_0.1mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Y-0.1 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Y/Minus/minus_100mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Y-100 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Z/Minus/minus_0.01mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Z-0.01 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Z/Minus/minus_0.1mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Z-0.1 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Menu/Prepare/Move_Axis/Move Z/Minus/minus_100mm.g: -------------------------------------------------------------------------------- 1 | G91 ;relative 2 | G0 Z-100 3 | G90 ;absolute 4 | -------------------------------------------------------------------------------- /MK/Configuration_Temperature.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/MK/Configuration_Temperature.h -------------------------------------------------------------------------------- /MK/Nextion FW/mk4duo_v0_8_8.HMI: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/MK/Nextion FW/mk4duo_v0_8_8.HMI -------------------------------------------------------------------------------- /MK/Nextion FW/mk4duo_v0_8_8.tft: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/MK/Nextion FW/mk4duo_v0_8_8.tft -------------------------------------------------------------------------------- /MK/fonts/ISO10646-5_Cyrillic.fon: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/MK/fonts/ISO10646-5_Cyrillic.fon -------------------------------------------------------------------------------- /Documentation/Laser/wiring_diagram.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/Documentation/Laser/wiring_diagram.jpg -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | MK/**/*.cpp linguist-language=Arduino 2 | MK/**/*.h linguist-language=Arduino 3 | Documentation/* linguist-documentation 4 | -------------------------------------------------------------------------------- /Documentation/[need update]Menu Plans.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/Documentation/[need update]Menu Plans.xlsx -------------------------------------------------------------------------------- /Documentation/[need update]LCD Menu Tree.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/Documentation/[need update]LCD Menu Tree.pdf -------------------------------------------------------------------------------- /Documentation/Logo/MarlinKimbra Logo GitHub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MKFirmware/MarlinKimbra/HEAD/Documentation/Logo/MarlinKimbra Logo GitHub.png -------------------------------------------------------------------------------- /MK/Configuration_Overall.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Configuration_Overall.h 3 | * Here you can define all your custom settings and they will overwrite configurations in the main configuration files. 4 | */ 5 | 6 | -------------------------------------------------------------------------------- /Documentation/RampsServoPower.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | __Note for RAMPS users:__ 4 | ---------------------- 5 | 6 | -By default, RAMPS have no power on servo bus (if you happen to have a multimeter, check the voltage on servo power pins). 7 | -In order to get the servo working, you need to supply 5V to 5V pin.. You can do it using your power supply (if it has a 5V output) or jumping the "Vcc" from Arduino to the 5V RAMPS rail. 8 | -These 2 pins are located just between the Reset Button and the yellow fuses... There are marks in the board showing 5V and VCC.. just connect them.. 9 | -If jumping the arduino Vcc do RAMPS 5V rail, take care to not use a power hungry servo, otherwise you will cause a blackout in the arduino board ;-) 10 | -------------------------------------------------------------------------------- /MK/fonts/make_fonts.bat: -------------------------------------------------------------------------------- 1 | .\bdf2u8g.exe -b 1 -e 9 Marlin_symbols.bdf Marlin_symbols dogm_font_data_Marlin_symbols.h 2 | .\bdf2u8g.exe -b 16 -e 255 HD44780_W.bdf HD44780_W_5x7 dogm_font_data_HD44780_W.h 3 | .\bdf2u8g.exe -b 32 -e 255 HD44780_C.bdf HD44780_C_5x7 dogm_font_data_HD44780_C.h 4 | .\bdf2u8g.exe -b 32 -e 255 HD44780_J.bdf HD44780_J_5x7 dogm_font_data_HD44780_J.h 5 | .\bdf2u8g.exe -b 32 -e 255 ISO10646-1.bdf ISO10646_1_5x7 dogm_font_data_ISO10646_1.h 6 | .\bdf2u8g.exe -b 32 -e 255 ISO10646_5_Cyrillic.bdf ISO10646_5_Cyrillic_5x7 dogm_font_data_ISO10646_5_Cyrillic.h 7 | .\bdf2u8g.exe -b 32 -e 255 ISO10646_Kana.bdf ISO10646_Kana_5x7 dogm_font_data_ISO10646_Kana.h 8 | .\bdf2u8g.exe -b 32 -e 255 ISO10646_CN.bdf ISO10646_CN dogm_font_data_ISO10646_CN.h 9 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexHotspot.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexHotspot.cpp 3 | * 4 | * The implementation of class NexHotspot. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * @copyright 9 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | */ 15 | 16 | #include "NexHotspot.h" 17 | 18 | NexHotspot::NexHotspot(uint8_t pid, uint8_t cid, const char *name) 19 | :NexTouch(pid, cid, name) 20 | { 21 | } 22 | 23 | -------------------------------------------------------------------------------- /Documentation/Compilation.md: -------------------------------------------------------------------------------- 1 | # Configuring and compilation 2 | 3 | 1. Install the LATES non-beta arduino software IDE/toolset: http://www.arduino.cc/en/Main/Software 4 | 2. Download the MarlinKimbra firmware 5 | https://github.com/MagoKimbra/MarlinKimbra 6 | Use the "Download Zip" button on the right. 7 | 3. Some boards require special files and/or libraries from the Arduino directory. 8 | 4. Start the arduino IDE 9 | 5. Select File -> Preferences -> Compiler warning and select none 10 | 6. Select Tools -> Board -> Arduino Mega 2560 or your microcontroller 11 | 7. Select the correct serial port in Tools ->Serial Port 12 | 8. Open MarlinKimbra.ino 13 | 9. Click the Verify/Compile button 14 | 10. Click the Upload button. If all goes well the firmware is uploading 15 | 16 | 17 | Guida in Italiano per la compilazione dei campi. 18 | http://forums.reprap.org/read.php?352,440672 19 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexObject.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexObject.cpp 3 | * 4 | * The implementation of class NexObject. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * @copyright 9 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | */ 15 | #include "NexObject.h" 16 | 17 | NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name) 18 | { 19 | this->__pid = pid; 20 | this->__cid = cid; 21 | this->__name = name; 22 | } 23 | 24 | uint8_t NexObject::getObjPid(void) 25 | { 26 | return __pid; 27 | } 28 | 29 | uint8_t NexObject::getObjCid(void) 30 | { 31 | return __cid; 32 | } 33 | 34 | const char* NexObject::getObjName(void) 35 | { 36 | return __name; 37 | } 38 | -------------------------------------------------------------------------------- /MK/src/fwtest/firmware_test.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef FIRMWARE_TEST_H 24 | #define FIRMWARE_TEST_H 25 | void FirmwareTest(); 26 | #endif 27 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexPage.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexPage.cpp 3 | * 4 | * The implementation of class NexPage. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * @copyright 9 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | */ 15 | 16 | #include "NexPage.h" 17 | 18 | NexPage::NexPage(uint8_t pid, uint8_t cid, const char *name) 19 | :NexTouch(pid, cid, name) 20 | { 21 | } 22 | 23 | bool NexPage::show(void) 24 | { 25 | uint8_t buffer[4] = {0}; 26 | 27 | const char *name = getObjName(); 28 | if (!name) 29 | { 30 | return false; 31 | } 32 | 33 | String cmd = String("page "); 34 | cmd += name; 35 | sendCommand(cmd.c_str()); 36 | return recvRetCommandFinished(); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /MK/src/types.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __TYPES_H__ 24 | #define __TYPES_H__ 25 | 26 | typedef unsigned long millis_t; 27 | 28 | #endif // __TYPES_H__ 29 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexConfig.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexConfig.h 3 | * 4 | * Options for user can be found here. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * @copyright 9 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | */ 15 | 16 | #include "../../../base.h" 17 | 18 | #ifndef __NEXCONFIG_H__ 19 | #define __NEXCONFIG_H__ 20 | 21 | #if NEXTION_SERIAL > 0 22 | #if NEXTION_SERIAL == 1 23 | #define nexSerial Serial1 24 | #elif NEXTION_SERIAL == 2 25 | #define nexSerial Serial2 26 | #elif NEXTION_SERIAL == 3 27 | #define nexSerial Serial3 28 | #endif 29 | #else 30 | #define nexSerial Serial1 31 | #endif 32 | 33 | #define dbSerialPrint(a) {} 34 | #define dbSerialPrintln(a) {} 35 | #define dbSerialBegin(a) {} 36 | 37 | #endif //__NEXCONFIG_H__ 38 | -------------------------------------------------------------------------------- /MK/src/lcd/buzzer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __BUZZER_H__ 24 | #define __BUZZER_H__ 25 | 26 | #if HAS(BUZZER) 27 | void buzz(long duration, uint16_t freq); 28 | #endif 29 | 30 | #endif // __BUZZER_H__ 31 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexHotspot.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexHotspot.h 3 | * 4 | * The definition of class NexHotspot. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * 9 | * @copyright 10 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 11 | * This program is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU General Public License as 13 | * published by the Free Software Foundation; either version 2 of 14 | * the License, or (at your option) any later version. 15 | */ 16 | 17 | #ifndef __NEXHOTSPOT_H__ 18 | #define __NEXHOTSPOT_H__ 19 | 20 | #include "NexTouch.h" 21 | #include "NexHardware.h" 22 | /** 23 | * @addtogroup Component 24 | * @{ 25 | */ 26 | 27 | /** 28 | * NexHotspot component. 29 | */ 30 | class NexHotspot: public NexTouch 31 | { 32 | public: /* methods */ 33 | /** 34 | * @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name); 35 | */ 36 | NexHotspot(uint8_t pid, uint8_t cid, const char *name); 37 | }; 38 | /** 39 | * @} 40 | */ 41 | 42 | 43 | #endif /* #ifndef __NEXHOTSPOT_H__ */ 44 | -------------------------------------------------------------------------------- /Documentation/FilamentSensor.md: -------------------------------------------------------------------------------- 1 | Filament Sensor 2 | --------------- 3 | Supports the use of a real time filament diameter sensor that measures the diameter of the filament going into the extruder and then adjusts the extrusion rate to compensate for filament that does not match what is defined in the g-code. The diameter can also be displayed on the LCD screen. This potentially eliminates the need to measure filament diameter when changing spools of filament. Gcode becomes independent of the filament diameter. Can also compensate for changing diameter. 4 | 5 | For examples of these sensors, see: http://www.thingiverse.com/thing:454584, https://www.youmagine.com/designs/filament-diameter-sensor, http://diy3dprinting.blogspot.com/2014/01/diy-filament-diameter-sensor.html. Any sensor which produces a voltage equivalent to the diameter in mm (i.e. 1v = 1mm) can be used. This provides a very simple interface and may encourage more innovation in this area. 6 | 7 | 4 new Mcodes are defined to set relevant parameters: M404, M405, M406, M407 - see above. 8 | 9 | Implements a delay buffer to handle the transit delay between where the filament is measured and when it gets to the extruder. -------------------------------------------------------------------------------- /MK/src/blinkm/blinkm.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | /** 24 | * blinkm.h 25 | * Library header file for BlinkM library 26 | */ 27 | 28 | #ifndef BLINKM_H 29 | #define BLINKM_H 30 | 31 | #if ENABLED(BLINKM) 32 | void SendColors(byte red, byte grn, byte blu); 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /MK/src/mbl/mesh_bed_leveling.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #include "../../base.h" 24 | 25 | #if ENABLED(MESH_BED_LEVELING) 26 | 27 | mesh_bed_leveling mbl; 28 | 29 | mesh_bed_leveling::mesh_bed_leveling() { reset(); } 30 | 31 | void mesh_bed_leveling::reset() { 32 | status = MBL_STATUS_NONE; 33 | z_offset = 0; 34 | memset(z_values, 0, sizeof(z_values)); 35 | } 36 | 37 | #endif // MESH_BED_LEVELING 38 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexPage.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexPage.h 3 | * 4 | * The definition of class NexPage. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * 9 | * @copyright 10 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 11 | * This program is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU General Public License as 13 | * published by the Free Software Foundation; either version 2 of 14 | * the License, or (at your option) any later version. 15 | */ 16 | 17 | #ifndef __NEXPAGE_H__ 18 | #define __NEXPAGE_H__ 19 | 20 | #include "NexTouch.h" 21 | #include "NexHardware.h" 22 | /** 23 | * @addtogroup Component 24 | * @{ 25 | */ 26 | 27 | /** 28 | * A special component , which can contain other components such as NexButton, 29 | * NexText and NexWaveform, etc. 30 | */ 31 | class NexPage: public NexTouch 32 | { 33 | public: /* methods */ 34 | /** 35 | * @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name); 36 | */ 37 | NexPage(uint8_t pid, uint8_t cid, const char *name); 38 | 39 | /** 40 | * Show itself. 41 | * 42 | * @return true if success, false for faileure. 43 | */ 44 | bool show(void); 45 | }; 46 | /** 47 | * @} 48 | */ 49 | 50 | #endif /* #ifndef __NEXPAGE_H__ */ 51 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/Nextion.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file Nextion.h 3 | * 4 | * The header file including all other header files provided by this library. 5 | * 6 | * Every example sketch should include this file. 7 | * 8 | * @author Wu Pengfei (email:) 9 | * @date 2015/8/12 10 | * @copyright 11 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 12 | * This program is free software; you can redistribute it and/or 13 | * modify it under the terms of the GNU General Public License as 14 | * published by the Free Software Foundation; either version 2 of 15 | * the License, or (at your option) any later version. 16 | */ 17 | #ifndef __NEXTION_H__ 18 | #define __NEXTION_H__ 19 | 20 | #include "Arduino.h" 21 | #include "NexConfig.h" 22 | #include "NexTouch.h" 23 | #include "NexHardware.h" 24 | #include "NexUpload.h" 25 | 26 | #include "NexButton.h" 27 | //#include "NexCrop.h" 28 | //#include "NexGauge.h" 29 | #include "NexHotspot.h" 30 | #include "NexPage.h" 31 | #include "NexPicture.h" 32 | #include "NexProgressBar.h" 33 | #include "NexSlider.h" 34 | #include "NexText.h" 35 | //#include "NexWaveform.h" 36 | #include "NexTimer.h" 37 | #include "NexNumber.h" 38 | #include "NexDualStateButton.h" 39 | #include "NexVariable.h" 40 | #include "NexCheckbox.h" 41 | //#include "NexRadio.h" 42 | #include "NexScrolltext.h" 43 | 44 | 45 | #endif /* #ifndef __NEXTION_H__ */ 46 | -------------------------------------------------------------------------------- /MK/src/mechanics.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef MECHANICS_H 24 | #define MECHANICS_H 25 | 26 | // Macros for mechanics type 27 | #define MECH_UNKNOWN -1 28 | #define MECH_CARTESIAN 0 29 | #define MECH_COREXY 1 30 | #define MECH_COREYX 2 31 | #define MECH_COREXZ 8 32 | #define MECH_COREZX 9 33 | #define MECH_DELTA 3 34 | #define MECH_SCARA 4 35 | 36 | #define MECH(mech) (MECHANISM == MECH_##mech) 37 | #define NOMECH(mech) (MECHANISM != MECH_##mech) 38 | 39 | #endif -------------------------------------------------------------------------------- /MK/Configuration_Version.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef CONFIGURATION_VERSION_H 24 | #define CONFIGURATION_VERSION_H 25 | 26 | #define FIRMWARE_NAME "MK" 27 | #define SHORT_BUILD_VERSION "4.2.9" 28 | #define BUILD_VERSION FIRMWARE_NAME "_" SHORT_BUILD_VERSION 29 | #define STRING_DISTRIBUTION_DATE __DATE__ " " __TIME__ // build date and time 30 | // It might also be appropriate to define a location where additional information can be found 31 | #define FIRMWARE_URL "https://github.com/MagoKimbra/MarlinKimbra" 32 | #endif 33 | -------------------------------------------------------------------------------- /MK/sd_card_menu/Music/imperial_march.gcode: -------------------------------------------------------------------------------- 1 | M300 S220 P500 2 | M300 S220 P500 3 | M300 S220 P500 4 | M300 S174.61 P375 5 | M300 S261.63 P125 6 | M300 S220 P500 7 | M300 S174.61 P375 8 | M300 S261.63 P125 9 | M300 S220 P1000 10 | M300 S329.63 P500 11 | M300 S329.63 P500 12 | M300 S329.63 P500 13 | M300 S349.23 P375 14 | M300 S261.63 P125 15 | M300 S207.65 P500 16 | M300 S174.61 P375 17 | M300 S261.63 P125 18 | M300 S220 P1000 19 | M300 S440 P500 20 | M300 S220 P375 21 | M300 S220 P125 22 | M300 S440 P500 23 | M300 S415.30 P375 24 | M300 S392 P125 25 | M300 S370 P125 26 | M300 S329.63 P125 27 | M300 S349.23 P250 28 | M300 S233.08 P250 29 | M300 S311.13 P500 30 | M300 S293.66 P375 31 | M300 S277.18 P125 32 | M300 S261.63 P125 33 | M300 S246.94 P125 34 | M300 S261.63 P250 35 | M300 S174.61 P250 36 | M300 S207.65 P500 37 | M300 S174.61 P375 38 | M300 S220 P125 39 | M300 S261.63 P500 40 | M300 S220 P375 41 | M300 S261.63 P125 42 | M300 S329.63 P1000 43 | M300 S440 P500 44 | M300 S220 P375 45 | M300 S220 P125 46 | M300 S440 P500 47 | M300 S415.30 P375 48 | M300 S392 P125 49 | M300 S370 P125 50 | M300 S329.63 P125 51 | M300 S349.23 P250 52 | M300 S233.08 P250 53 | M300 S311.13 P500 54 | M300 S293.66 P375 55 | M300 S277.18 P125 56 | M300 S261.63 P125 57 | M300 S246.94 P125 58 | M300 S261.63 P250 59 | M300 S174.61 P250 60 | M300 S207.65 P500 61 | M300 S174.61 P375 62 | M300 S261.63 P125 63 | M300 S220 P500 64 | M300 S174.61 P375 65 | M300 S261.63 P125 66 | M300 S220 P1000 67 | -------------------------------------------------------------------------------- /MK/src/digipot/digipot_mcp4451.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef DIGIPOT_MCP4451_H 24 | #define DIGIPOT_MCP4451_H 25 | 26 | // Settings for the I2C based DIGIPOT (MCP4451) on Azteeg X3 Pro 27 | #if MB(5DPRINT) 28 | #define DIGIPOT_I2C_FACTOR 117.96 29 | #define DIGIPOT_I2C_MAX_CURRENT 1.736 30 | #else 31 | #define DIGIPOT_I2C_FACTOR 106.7 32 | #define DIGIPOT_I2C_MAX_CURRENT 2.5 33 | #endif 34 | 35 | static byte current_to_wiper(float current); 36 | static void i2c_send(byte addr, byte a, byte b); 37 | // This is for the MCP4451 I2C based digipot 38 | void digipot_i2c_set_current(int channel, float current); 39 | void digipot_i2c_init(); 40 | 41 | #endif -------------------------------------------------------------------------------- /MK/src/blinkm/blinkm.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | /** 24 | * blinkm.cpp - Library for controlling a BlinkM over i2c 25 | * Created by Tim Koster, August 21 2013. 26 | */ 27 | 28 | #include "../../base.h" 29 | 30 | #if ENABLED(BLINKM) 31 | #include "blinkm.h" 32 | #include 33 | 34 | void SendColors(byte red, byte grn, byte blu) { 35 | Wire.begin(); 36 | Wire.beginTransmission(0x09); 37 | Wire.write('o'); //to disable ongoing script, only needs to be used once 38 | Wire.write('n'); 39 | Wire.write(red); 40 | Wire.write(grn); 41 | Wire.write(blu); 42 | Wire.endTransmission(); 43 | } 44 | 45 | #endif // BLINKM 46 | -------------------------------------------------------------------------------- /MK/src/boards/99.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 99 3 | * Custom board 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 1 7 | 8 | #define ORIG_X_STEP_PIN 2 9 | #define ORIG_X_DIR_PIN 3 10 | #define ORIG_X_ENABLE_PIN -1 11 | #define X_STOP_PIN 16 12 | 13 | #define ORIG_Y_STEP_PIN 5 14 | #define ORIG_Y_DIR_PIN 6 15 | #define ORIG_Y_ENABLE_PIN -1 16 | #define Y_STOP_PIN 67 17 | 18 | #define ORIG_Z_STEP_PIN 62 19 | #define ORIG_Z_DIR_PIN 63 20 | #define ORIG_Z_ENABLE_PIN -1 21 | #define Z_STOP_PIN 59 22 | 23 | #define ORIG_E0_STEP_PIN 65 24 | #define ORIG_E0_DIR_PIN 66 25 | #define ORIG_E0_ENABLE_PIN -1 26 | 27 | #define SDPOWER -1 28 | #define SDSS 53 29 | #define LED_PIN -1 30 | #define ORIG_FAN_PIN -1 31 | #define ORIG_PS_ON_PIN 9 32 | #define KILL_PIN -1 33 | 34 | #define ORIG_HEATER_0_PIN 13 35 | #define ORIG_HEATER_1_PIN -1 36 | #define ORIG_HEATER_2_PIN -1 37 | #define ORIG_TEMP_0_PIN 6 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! 38 | #define ORIG_TEMP_1_PIN -1 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! 39 | #define ORIG_TEMP_2_PIN -1 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! 40 | #define ORIG_HEATER_BED_PIN 4 41 | #define ORIG_TEMP_BED_PIN 10 42 | 43 | -------------------------------------------------------------------------------- /MK/scripts/create_speed_lookuptable.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | """ Generate the stepper delay lookup table for Marlin firmware. """ 4 | 5 | import argparse 6 | 7 | __author__ = "Ben Gamari " 8 | __copyright__ = "Copyright 2012, Ben Gamari" 9 | __license__ = "GPL" 10 | 11 | parser = argparse.ArgumentParser(description=__doc__) 12 | parser.add_argument('-f', '--cpu-freq', type=int, default=16, help='CPU clockrate in MHz (default=16)') 13 | parser.add_argument('-d', '--divider', type=int, default=8, help='Timer/counter pre-scale divider (default=8)') 14 | args = parser.parse_args() 15 | 16 | cpu_freq = args.cpu_freq * 1000000 17 | timer_freq = cpu_freq / args.divider 18 | 19 | print "#ifndef SPEED_LOOKUPTABLE_H" 20 | print "#define SPEED_LOOKUPTABLE_H" 21 | print 22 | print '#include "Marlin.h"' 23 | print 24 | 25 | print "const uint16_t speed_lookuptable_fast[256][2] PROGMEM = {" 26 | a = [ timer_freq / ((i*256)+(args.cpu_freq*2)) for i in range(256) ] 27 | b = [ a[i] - a[i+1] for i in range(255) ] 28 | b.append(b[-1]) 29 | for i in range(32): 30 | print " ", 31 | for j in range(8): 32 | print "{%d, %d}," % (a[8*i+j], b[8*i+j]), 33 | print 34 | print "};" 35 | print 36 | 37 | print "const uint16_t speed_lookuptable_slow[256][2] PROGMEM = {" 38 | a = [ timer_freq / ((i*8)+(args.cpu_freq*2)) for i in range(256) ] 39 | b = [ a[i] - a[i+1] for i in range(255) ] 40 | b.append(b[-1]) 41 | for i in range(32): 42 | print " ", 43 | for j in range(8): 44 | print "{%d, %d}," % (a[8*i+j], b[8*i+j]), 45 | print 46 | print "};" 47 | print 48 | 49 | print "#endif" 50 | 51 | -------------------------------------------------------------------------------- /MK/src/boards/4.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 4 3 | * Duemilanove w/ ATMega328P 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 1 7 | #define BOARD_NAME "2009" 8 | 9 | #ifndef __AVR_ATmega328P__ 10 | #error Oops! Make sure you have 'Arduino Duemilanove w/ ATMega328' selected from the 'Tools -> Boards' menu. 11 | #endif 12 | 13 | #define ORIG_X_STEP_PIN 19 14 | #define ORIG_X_DIR_PIN 18 15 | #define ORIG_X_ENABLE_PIN -1 16 | #define X_STOP_PIN 17 17 | 18 | #define ORIG_Y_STEP_PIN 10 19 | #define ORIG_Y_DIR_PIN 7 20 | #define ORIG_Y_ENABLE_PIN -1 21 | #define Y_STOP_PIN 8 22 | 23 | #define ORIG_Z_STEP_PIN 13 24 | #define ORIG_Z_DIR_PIN 3 25 | #define ORIG_Z_ENABLE_PIN 2 26 | #define Z_STOP_PIN 4 27 | 28 | #define ORIG_E0_STEP_PIN 11 29 | #define ORIG_E0_DIR_PIN 12 30 | #define ORIG_E0_ENABLE_PIN -1 31 | 32 | #define SDPOWER -1 33 | #define SDSS -1 34 | #define LED_PIN -1 35 | #define ORIG_FAN_PIN 5 36 | #define ORIG_PS_ON_PIN -1 37 | #define KILL_PIN -1 38 | 39 | #define ORIG_HEATER_0_PIN 6 40 | #define ORIG_HEATER_1_PIN -1 41 | #define ORIG_HEATER_2_PIN -1 42 | #define ORIG_TEMP_0_PIN 0 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! 43 | #define ORIG_TEMP_1_PIN -1 44 | #define ORIG_TEMP_2_PIN -1 45 | #define ORIG_HEATER_BED_PIN -1 46 | #define ORIG_TEMP_BED_PIN -1 47 | 48 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexCrop.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexCrop.cpp 3 | * 4 | * The implementation of class NexCrop. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * @copyright 9 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | */ 15 | 16 | #include "NexCrop.h" 17 | 18 | NexCrop::NexCrop(uint8_t pid, uint8_t cid, const char *name) 19 | :NexTouch(pid, cid, name) 20 | { 21 | } 22 | 23 | bool NexCrop::Get_background_crop_picc(uint32_t *number) 24 | { 25 | String cmd = String("get "); 26 | cmd += getObjName(); 27 | cmd += ".picc"; 28 | sendCommand(cmd.c_str()); 29 | return recvRetNumber(number); 30 | } 31 | 32 | bool NexCrop::Set_background_crop_picc(uint32_t number) 33 | { 34 | char buf[10] = {0}; 35 | String cmd; 36 | 37 | utoa(number, buf, 10); 38 | cmd += getObjName(); 39 | cmd += ".picc="; 40 | cmd += buf; 41 | 42 | sendCommand(cmd.c_str()); 43 | return recvRetCommandFinished(); 44 | } 45 | 46 | bool NexCrop::getPic(uint32_t *number) 47 | { 48 | String cmd = String("get "); 49 | cmd += getObjName(); 50 | cmd += ".picc"; 51 | sendCommand(cmd.c_str()); 52 | return recvRetNumber(number); 53 | } 54 | 55 | bool NexCrop::setPic(uint32_t number) 56 | { 57 | char buf[10] = {0}; 58 | String cmd; 59 | 60 | utoa(number, buf, 10); 61 | cmd += getObjName(); 62 | cmd += ".picc="; 63 | cmd += buf; 64 | 65 | sendCommand(cmd.c_str()); 66 | return recvRetCommandFinished(); 67 | } 68 | 69 | -------------------------------------------------------------------------------- /MK/src/boards/9.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 9 3 | * Gen3+ 4 | ****************************************************************************************/ 5 | 6 | #define MOTHERBOARD BOARD_SANGUINOLOLU_11 /*TODO: Figure out, Why is this done?*/ 7 | #define KNOWN_BOARD 1 8 | #ifndef __AVR_ATmega644P__ 9 | #ifndef __AVR_ATmega1284P__ 10 | #error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu. 11 | #endif 12 | #endif 13 | 14 | #define ORIG_X_STEP_PIN 15 15 | #define ORIG_X_DIR_PIN 18 16 | #define X_STOP_PIN 20 17 | 18 | #define ORIG_Y_STEP_PIN 23 19 | #define ORIG_Y_DIR_PIN 22 20 | #define Y_STOP_PIN 25 21 | 22 | #define ORIG_Z_STEP_PIN 27 23 | #define ORIG_Z_DIR_PIN 28 24 | #define Z_STOP_PIN 30 25 | 26 | #define ORIG_E0_STEP_PIN 17 27 | #define ORIG_E0_DIR_PIN 21 28 | 29 | #define LED_PIN -1 30 | 31 | #define ORIG_FAN_PIN -1 32 | 33 | #define ORIG_PS_ON_PIN 14 34 | #define KILL_PIN -1 35 | 36 | #define ORIG_HEATER_0_PIN 12 // (extruder) 37 | 38 | #define ORIG_HEATER_BED_PIN 16 // (bed) 39 | #define ORIG_X_ENABLE_PIN 19 40 | #define ORIG_Y_ENABLE_PIN 24 41 | #define ORIG_Z_ENABLE_PIN 29 42 | #define ORIG_E0_ENABLE_PIN 13 43 | 44 | #define ORIG_TEMP_0_PIN 0 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 33 extruder) 45 | #define ORIG_TEMP_1_PIN -1 46 | #define ORIG_TEMP_2_PIN -1 47 | #define ORIG_TEMP_BED_PIN 5 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 34 bed) 48 | #define SDPOWER -1 49 | #define SDSS 4 50 | #define ORIG_HEATER_2_PIN -1 51 | 52 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexHardware.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexHardware.h 3 | * 4 | * The definition of base API for using Nextion. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/11 8 | * @copyright 9 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | */ 15 | #ifndef __NEXHARDWARE_H__ 16 | #define __NEXHARDWARE_H__ 17 | 18 | #include 19 | #include "NexConfig.h" 20 | #include "NexTouch.h" 21 | 22 | /** 23 | * @addtogroup CoreAPI 24 | * @{ 25 | */ 26 | 27 | /** 28 | * Init Nextion. 29 | * 30 | * @return true if success, false for failure. 31 | */ 32 | bool nexInit(void); 33 | 34 | /** 35 | * Listen touch event and calling callbacks attached before. 36 | * 37 | * Supports push and pop at present. 38 | * 39 | * @param nex_listen_list - index to Nextion Components list. 40 | * @return none. 41 | * 42 | * @warning This function must be called repeatedly to response touch events 43 | * from Nextion touch panel. Actually, you should place it in your loop function. 44 | */ 45 | void nexLoop(NexTouch *nex_listen_list[]); 46 | 47 | /** 48 | * @} 49 | */ 50 | 51 | bool recvRetNumber(uint32_t *number, uint32_t timeout = 100); 52 | uint16_t recvRetString(char *buffer, uint16_t len, uint32_t timeout = 100); 53 | void sendCommand(const char* cmd); 54 | bool recvRetCommandFinished(uint32_t timeout = 100); 55 | 56 | bool sendCurrentPageId(uint8_t* pageId); 57 | bool setCurrentBrightness(uint8_t dimValue); 58 | bool setDefaultBaudrate(uint32_t baudrate); 59 | void sendRefreshAll(void); 60 | 61 | #endif /* #ifndef __NEXHARDWARE_H__ */ 62 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexVariable.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexVariable.cpp 3 | * 4 | * The implementation of class NexText. 5 | * 6 | * @author huang xiaoming (email:) 7 | * @date 2016/9/13 8 | * @copyright 9 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | */ 15 | #include "NexVariable.h" 16 | 17 | NexVariable::NexVariable(uint8_t pid, uint8_t cid, const char *name) 18 | :NexTouch(pid, cid, name) 19 | { 20 | } 21 | 22 | uint32_t NexVariable::getValue(uint32_t *number) 23 | { 24 | String cmd = String("get "); 25 | cmd += getObjName(); 26 | cmd += ".val"; 27 | sendCommand(cmd.c_str()); 28 | return recvRetNumber(number); 29 | } 30 | 31 | bool NexVariable::setValue(uint32_t number, const char *pname) 32 | { 33 | char buf[10] = {0}; 34 | String cmd; 35 | 36 | utoa(number, buf, 10); 37 | 38 | if (pname != "") { 39 | cmd += pname; 40 | cmd += "."; 41 | } 42 | cmd += getObjName(); 43 | cmd += ".val="; 44 | cmd += buf; 45 | 46 | sendCommand(cmd.c_str()); 47 | return recvRetCommandFinished(); 48 | } 49 | 50 | uint32_t NexVariable::getText(char *buffer, uint32_t len) 51 | { 52 | String cmd; 53 | cmd += "get "; 54 | cmd += getObjName(); 55 | cmd += ".txt"; 56 | sendCommand(cmd.c_str()); 57 | return recvRetString(buffer,len); 58 | } 59 | 60 | bool NexVariable::setText(const char *buffer) 61 | { 62 | String cmd; 63 | cmd += getObjName(); 64 | cmd += ".txt=\""; 65 | cmd += buffer; 66 | cmd += "\""; 67 | sendCommand(cmd.c_str()); 68 | return recvRetCommandFinished(); 69 | } -------------------------------------------------------------------------------- /MK/src/boards/13.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 13 3 | * Gen7 v1.4 pin assignment 4 | ****************************************************************************************/ 5 | 6 | #define GEN7_VERSION 14 // v1.4 7 | #define KNOWN_BOARD 8 | 9 | #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__) 10 | #error Oops! Make sure you have 'Gen7' selected from the 'Tools -> Boards' menu. 11 | #endif 12 | 13 | //X axis pins 14 | #define ORIG_X_STEP_PIN 29 15 | #define ORIG_X_DIR_PIN 28 16 | #define ORIG_X_ENABLE_PIN 25 17 | #define X_STOP_PIN 0 18 | 19 | //Y axis pins 20 | #define ORIG_Y_STEP_PIN 27 21 | #define ORIG_Y_DIR_PIN 26 22 | #define ORIG_Y_ENABLE_PIN 25 23 | #define Y_STOP_PIN 1 24 | 25 | //Z axis pins 26 | #define ORIG_Z_STEP_PIN 23 27 | #define ORIG_Z_DIR_PIN 22 28 | #define ORIG_Z_ENABLE_PIN 25 29 | #define Z_STOP_PIN 2 30 | 31 | //extruder pins 32 | #define ORIG_E0_STEP_PIN 19 33 | #define ORIG_E0_DIR_PIN 18 34 | #define ORIG_E0_ENABLE_PIN 25 35 | 36 | #define ORIG_TEMP_0_PIN 1 37 | #define ORIG_TEMP_1_PIN -1 38 | #define ORIG_TEMP_2_PIN -1 39 | #define ORIG_TEMP_BED_PIN 0 40 | 41 | #define ORIG_HEATER_0_PIN 4 42 | #define ORIG_HEATER_1_PIN -1 43 | #define ORIG_HEATER_2_PIN -1 44 | #define ORIG_HEATER_BED_PIN 3 45 | 46 | #define KILL_PIN -1 47 | 48 | #define SDPOWER -1 49 | #define SDSS -1 // SCL pin of I2C header 50 | #define LED_PIN -1 51 | 52 | #define ORIG_FAN_PIN -1 53 | 54 | #define ORIG_PS_ON_PIN 15 55 | 56 | //our pin for debugging. 57 | #define DEBUG_PIN 0 58 | 59 | //our RS485 pins 60 | #define TORIG_X_ENABLE_PIN 12 61 | #define RORIG_X_ENABLE_PIN 13 62 | -------------------------------------------------------------------------------- /MK/src/boards/408.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 408 3 | * Arduino pin assignment 4 | * for SMART_RAMPS 5 | ****************************************************************************************/ 6 | 7 | #define KNOWN_BOARD 8 | #define BOARD_NAME "SMART RAMPS" 9 | 10 | #ifndef __SAM3X8E__ 11 | #error Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu. 12 | #endif 13 | 14 | #define ORIG_X_STEP_PIN 54 15 | #define ORIG_X_DIR_PIN 55 16 | #define ORIG_X_ENABLE_PIN 38 17 | #define ORIG_X_MIN_PIN 3 18 | #define ORIG_X_MAX_PIN 2 19 | 20 | #define ORIG_Y_STEP_PIN 60 21 | #define ORIG_Y_DIR_PIN 61 22 | #define ORIG_Y_ENABLE_PIN 56 23 | #define ORIG_Y_MIN_PIN 14 24 | #define ORIG_Y_MAX_PIN 15 25 | 26 | #define ORIG_Z_STEP_PIN 46 27 | #define ORIG_Z_DIR_PIN 48 28 | #define ORIG_Z_ENABLE_PIN 62 29 | #define ORIG_Z_MIN_PIN 18 30 | #define ORIG_Z_MAX_PIN 19 31 | 32 | #define ORIG_HEATER_0_PIN 10 33 | #define ORIG_HEATER_1_PIN 9 34 | #define ORIG_HEATER_BED_PIN 8 35 | 36 | #define ORIG_TEMP_0_PIN 9 // ANALOG NUMBERING 37 | #define ORIG_TEMP_1_PIN 10 // ANALOG NUMBERING 38 | #define ORIG_TEMP_BED_PIN 11 // ANALOG NUMBERING 39 | 40 | #define ORIG_E0_STEP_PIN 26 41 | #define ORIG_E0_DIR_PIN 28 42 | #define ORIG_E0_ENABLE_PIN 24 43 | 44 | #define ORIG_E1_STEP_PIN 36 45 | #define ORIG_E1_DIR_PIN 34 46 | #define ORIG_E1_ENABLE_PIN 30 47 | 48 | #define SDPOWER -1 49 | #define SDSS 53 // 10 if using HW SPI. 53 if using SW SPI 50 | #define LED_PIN 13 51 | #define ORIG_FAN_PIN 9 52 | #define ORIG_PS_ON_PIN 12 53 | #define KILL_PIN -1 54 | #define SUICIDE_PIN -1 // PIN that has to be turned on right after start, to keep power flowing 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /MK/src/boards/82.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 82 3 | * Brainwave 1.0 pin assignments (AT90USB646) 4 | * Requires hardware bundle for Arduino: 5 | * https://github.com/unrepentantgeek/brainwave-arduino 6 | ****************************************************************************************/ 7 | 8 | #define KNOWN_BOARD 1 9 | 10 | #define AT90USB 646 // Disable MarlinSerial etc. 11 | 12 | #ifndef __AVR_AT90USB646__ 13 | #error Oops! Make sure you have 'Brainwave' selected from the 'Tools -> Boards' menu. 14 | #endif 15 | 16 | #define ORIG_X_STEP_PIN 27 17 | #define ORIG_X_DIR_PIN 29 18 | #define ORIG_X_ENABLE_PIN 28 19 | #define X_STOP_PIN 7 20 | #define X_ATT_PIN 26 21 | 22 | #define ORIG_Y_STEP_PIN 31 23 | #define ORIG_Y_DIR_PIN 33 24 | #define ORIG_Y_ENABLE_PIN 32 25 | #define Y_STOP_PIN 6 26 | #define Y_ATT_PIN 30 27 | 28 | #define ORIG_Z_STEP_PIN 17 29 | #define ORIG_Z_DIR_PIN 19 30 | #define ORIG_Z_ENABLE_PIN 18 31 | #define Z_STOP_PIN 5 32 | #define Z_ATT_PIN 16 33 | 34 | #define ORIG_E0_STEP_PIN 21 35 | #define ORIG_E0_DIR_PIN 23 36 | #define ORIG_E0_ENABLE_PIN 22 37 | #define E0_ATT_PIN 20 38 | 39 | #define ORIG_HEATER_0_PIN 4 // Extruder 40 | #define ORIG_HEATER_1_PIN -1 41 | #define ORIG_HEATER_2_PIN -1 42 | #define ORIG_HEATER_BED_PIN 38 // Bed 43 | #define ORIG_FAN_PIN 3 // Fan 44 | 45 | #define ORIG_TEMP_0_PIN 7 // Extruder / Analog pin numbering 46 | #define ORIG_TEMP_1_PIN -1 47 | #define ORIG_TEMP_2_PIN -1 48 | #define ORIG_TEMP_BED_PIN 6 // Bed / Analog pin numbering 49 | 50 | #define SDPOWER -1 51 | #define SDSS -1 52 | #define LED_PIN 39 53 | #define ORIG_PS_ON_PIN -1 54 | #define KILL_PIN -1 55 | #define ALARM_PIN -1 56 | 57 | 58 | -------------------------------------------------------------------------------- /MK/fonts/README.fonts: -------------------------------------------------------------------------------- 1 | The fonts are created with Fony.exe (http://hukka.ncn.fi/?fony) because Fontforge didn't do what I want (probably lack off experience). 2 | In Fony export the fonts to bdf-format. Maybe another one can edit them with Fontforge. 3 | Then run make_fonts.bat what calls bdf2u8g.exe with the needed parameters to produce the .h files. 4 | The .h files must be edited to replace '#include "u8g.h"' with '#include ', replace 'U8G_FONT_SECTION' with 'U8G_SECTION', insert '.progmem.' right behind the first '"' and moved to the main directory. 5 | 6 | How to integrate a new font: 7 | Currently we are limited to 256 symbols per font. We use a menu system with 5 lines, on a display with 64 pixel height. That means we have 12 pixel for a line. To have some space in between the lines we can't use more then 10 pixel height for the symbols. For up to 11 pixel set TALL_FONT_CORRECTION 1 when loading the font. 8 | To fit 22 Symbols on the 128 pixel wide screen, the symbols can't be wider than 5 pixel, for the first 128 symbols. 9 | For the second half of the font we now support up to 11x11 pixel. 10 | 11 | * Get 'Fony.exe' 12 | * Copy one of the existing *.fon files and work with this. 13 | * Change the pixels. Don't change width or height. 14 | * Export as *.bdf 15 | * Use 'bdf2u8g.exe' to produce the *.h file. Examples for the existing fonts are in 'make_fonts.bat' 16 | * Edit the produced .h file to match our needs. See hints in 'README.fonts' or the other 'dogm_font_data_.h' files. 17 | * Make a new entry in the font list in 'dogm_lcd_implementation.h' before the '#else // fall back' 18 | #elif ENABLED(DISPLAY_CHARSET_NEWNAME) 19 | #include "dogm_font_data_yourfont.h" 20 | #define FONT_MENU_NAME YOURFONTNAME 21 | #else // fall-back 22 | * Add your font to the list of permitted fonts in 'language_en.h' 23 | ... || ENABLED(DISPLAY_CHARSET_YOUR_NEW_FONT) ... ) 24 | 25 | 26 | Especially the Kana font should be revised by someone who knows what he/she does. I am only a west-European with very little knowledge about this script. 27 | -------------------------------------------------------------------------------- /MK/src/boards/22.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 22 3 | * Gen3 Monolithic Electronics 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 1 7 | 8 | #ifndef __AVR_ATmega644P__ 9 | #error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu. 10 | #endif 11 | 12 | #define DEBUG_PIN 0 13 | 14 | // x axis 15 | #define ORIG_X_STEP_PIN 15 16 | #define ORIG_X_DIR_PIN 18 17 | #define ORIG_X_MIN_PIN 20 18 | //Alex Checar #define X_STOP_PIN 20 19 | #define ORIG_X_ENABLE_PIN 24 // actually uses ORIG_Y_DIR_PIN 20 | #define ORIG_X_MAX_PIN -1 21 | 22 | // y axes 23 | #define ORIG_Y_STEP_PIN 23 24 | #define ORIG_Y_DIR_PIN 22 25 | #define ORIG_Y_MIN_PIN 25 26 | //Alex Checar #define Y_STOP_PIN 25 27 | #define ORIG_Y_ENABLE_PIN 24 // shared with ORIG_X_ENABLE_PIN 28 | #define ORIG_Y_MAX_PIN -1 29 | 30 | // z axes 31 | #define ORIG_Z_STEP_PIN 27 32 | #define ORIG_Z_DIR_PIN 28 33 | #define ORIG_Z_MIN_PIN 30 34 | //Alex Checar #define Z_STOP_PIN 30 35 | #define ORIG_Z_ENABLE_PIN 29 36 | #define ORIG_Z_MAX_PIN -1 37 | 38 | //extruder pins 39 | #define ORIG_E0_STEP_PIN 12 40 | #define ORIG_E0_DIR_PIN 17 41 | #define ORIG_E0_ENABLE_PIN 3 42 | 43 | #define ORIG_HEATER_0_PIN 16 44 | #define ORIG_TEMP_0_PIN 0 45 | 46 | #define ORIG_FAN_PIN -1 47 | 48 | //bed pins 49 | #define ORIG_HEATER_BED_PIN -1 50 | #define ORIG_TEMP_BED_PIN -1 51 | 52 | #define SDSS -1 53 | #define SDPOWER -1 54 | #define LED_PIN -1 55 | 56 | //pin for controlling the PSU. 57 | #define ORIG_PS_ON_PIN 14 58 | 59 | //Alex extras from Gen3+ 60 | #define KILL_PIN -1 61 | #define ORIG_TEMP_1_PIN -1 62 | #define ORIG_TEMP_2_PIN -1 63 | #define ORIG_HEATER_2_PIN -1 64 | -------------------------------------------------------------------------------- /Documentation/CurrentSensor.md: -------------------------------------------------------------------------------- 1 | Power consumption sensor (Hall effect sensor like ACS712) 2 | --------------------------------------------------------- 3 | Support for a current sensor (Hall effect sensor like ACS712) for measure the power consumption 4 | Since it's more simple to deal with, we measure the DC current and we assume that POWER_VOLTAGE that comes from your power supply it's almost stable. 5 | You have to change the POWER_SENSITIVITY with the one that you can find in the datasheet. (in case of ACS712: set to .100 for 20A version or set .066 for 30A version) 6 | 7 | After setted POWER_VOLTAGE and POWER_SENSITIVITY you have to found correct value for POWER_ZERO. 8 | You can do it by using "M70 Z" gcode and read the calculated value from serial messages. 9 | Before calling "M70 Z" you have to disconnect the cable for measure the current from the sensor leaving only +5, OUT and GND connections. 10 | Insert new values into FW and recompile. 11 | Now you can reconnect the current cable to the sensor. 12 | 13 | Now you have to set right value for POWER_ERROR. 14 | Get a good multimeter and meacure DC current coming out from the power supply. 15 | In order to get an accurate value power-on something (Eg. Heater, Motor, Fan) DO NOT POWER-ON THE BED OR YOU MAY KILL IT!!!! 16 | Call "M70 Ax" where 'x' is the value measured by the multimeter. 17 | Insert new values into FW and recompile. 18 | 19 | With this module we measure the Printer power consumption ignoring the Power Supply power consumption, 20 | so we consider the POWER_EFFICIENCY of our supply to be 100%. 21 | WARNING: from this moment the procedure can be REALLY HARMFUL to health unless you have a little experience so DO NOT DO IT IF YOU DO NOT KNOW WHAT YOU ARE DOING!!! 22 | If you want to approximately add the supply consumption you have measure the AC current with a good multimeter 23 | and moltiple it with the mains voltage (110V AC - 220V AC). 24 | MULTIMETER_WATT = MULTIMETER_CURRENTMAINS_VOLTAGE 25 | Call "M70 Wx" where 'x' is MULTIMETER_WATT; 26 | Insert new values into FW and recompile. 27 | 28 | Now you AC712 it should be calibrated. -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexObject.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexObject.h 3 | * 4 | * The definition of class NexObject. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * 9 | * @copyright 10 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 11 | * This program is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU General Public License as 13 | * published by the Free Software Foundation; either version 2 of 14 | * the License, or (at your option) any later version. 15 | */ 16 | #ifndef __NEXOBJECT_H__ 17 | #define __NEXOBJECT_H__ 18 | #include 19 | #include "NexConfig.h" 20 | /** 21 | * @addtogroup CoreAPI 22 | * @{ 23 | */ 24 | 25 | /** 26 | * Root class of all Nextion components. 27 | * 28 | * Provides the essential attributes of a Nextion component and the methods accessing 29 | * them. At least, Page ID(pid), Component ID(pid) and an unique name are needed for 30 | * creating a component in Nexiton library. 31 | */ 32 | class NexObject 33 | { 34 | public: /* methods */ 35 | 36 | /** 37 | * Constructor. 38 | * 39 | * @param pid - page id. 40 | * @param cid - component id. 41 | * @param name - pointer to an unique name in range of all components. 42 | */ 43 | NexObject(uint8_t pid, uint8_t cid, const char *name); 44 | 45 | protected: /* methods */ 46 | 47 | /* 48 | * Get page id. 49 | * 50 | * @return the id of page. 51 | */ 52 | uint8_t getObjPid(void); 53 | 54 | /* 55 | * Get component id. 56 | * 57 | * @return the id of component. 58 | */ 59 | uint8_t getObjCid(void); 60 | 61 | /* 62 | * Get component name. 63 | * 64 | * @return the name of component. 65 | */ 66 | const char *getObjName(void); 67 | 68 | private: /* data */ 69 | uint8_t __pid; /* Page ID */ 70 | uint8_t __cid; /* Component ID */ 71 | const char *__name; /* An unique name */ 72 | }; 73 | /** 74 | * @} 75 | */ 76 | 77 | #endif /* #ifndef __NEXOBJECT_H__ */ 78 | -------------------------------------------------------------------------------- /MK/src/lcd/dogm_font_data_Marlin_symbols.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | /** 24 | Fontname: Marlin_symbols 25 | Copyright: Created with Fony 1.4.7 26 | Capital A Height: 0, '1' Height: 0 27 | Calculated Max Values w= 5 h=10 x= 0 y= 3 dx= 6 dy= 0 ascent= 8 len=10 28 | Font Bounding box w= 6 h= 9 x= 0 y=-2 29 | Calculated Min Values x= 0 y=-2 dx= 0 dy= 0 30 | Pure Font ascent = 0 descent= 0 31 | X Font ascent = 0 descent= 0 32 | Max Font ascent = 8 descent=-2 33 | */ 34 | #include 35 | const u8g_fntpgm_uint8_t Marlin_symbols[140] U8G_SECTION(".progmem.Marlin_symbols") = { 36 | 0, 6, 9, 0, 254, 0, 0, 0, 0, 0, 1, 9, 0, 8, 254, 0, 37 | 0, 5, 8, 8, 6, 0, 0, 64, 240, 200, 136, 136, 152, 120, 16, 5, 38 | 8, 8, 6, 0, 0, 192, 248, 136, 136, 136, 136, 136, 248, 5, 5, 5, 39 | 6, 0, 1, 32, 48, 248, 48, 32, 5, 8, 8, 6, 0, 0, 32, 112, 40 | 248, 32, 32, 32, 32, 224, 5, 9, 9, 6, 0, 255, 32, 112, 168, 168, 41 | 184, 136, 136, 112, 32, 5, 9, 9, 6, 0, 255, 224, 128, 192, 176, 168, 42 | 40, 48, 40, 40, 5, 9, 9, 6, 0, 255, 248, 168, 136, 136, 136, 136, 43 | 136, 168, 248, 5, 10, 10, 6, 0, 254, 32, 80, 80, 80, 80, 136, 168, 44 | 168, 136, 112, 3, 3, 3, 6, 0, 3, 64, 160, 64 45 | }; 46 | -------------------------------------------------------------------------------- /MK/src/lcd/buzzer.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #include "../../base.h" 24 | 25 | #if HAS(BUZZER) 26 | #include "buzzer.h" 27 | 28 | void buzz(long duration, uint16_t freq) { 29 | if (freq > 0) { 30 | #if ENABLED(LCD_USE_I2C_BUZZER) 31 | lcd_buzz(duration, freq); 32 | #elif PIN_EXISTS(BEEPER) // on-board buzzers have no further condition 33 | SET_OUTPUT(BEEPER_PIN); 34 | #if ENABLED(SPEAKER) // a speaker needs a AC ore a pulsed DC 35 | //tone(BEEPER_PIN, freq, duration); // needs a PWMable pin 36 | unsigned int delay = 1000000 / freq / 2; 37 | int i = duration * freq / 1000; 38 | while (i--) { 39 | WRITE(BEEPER_PIN, HIGH); 40 | HAL::delayMicroseconds(delay); 41 | WRITE(BEEPER_PIN, LOW); 42 | HAL::delayMicroseconds(delay); 43 | } 44 | #else // buzzer has its own resonator - needs a DC 45 | tone(BEEPER_PIN, freq, duration); 46 | HAL::delayMilliseconds(1 + duration); 47 | #endif 48 | #else 49 | HAL::delayMilliseconds(duration); 50 | #endif 51 | } 52 | else { 53 | HAL::delayMilliseconds(duration); 54 | } 55 | } 56 | #endif 57 | -------------------------------------------------------------------------------- /MK/src/boards/71.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 71 3 | * Ultimaker pin assignment (Old electronics) 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 7 | 8 | #ifndef __AVR_ATmega1280__ 9 | #ifndef __AVR_ATmega2560__ 10 | #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu. 11 | #endif 12 | #endif 13 | 14 | #define LARGE_FLASH true 15 | 16 | #define ORIG_X_STEP_PIN 25 17 | #define ORIG_X_DIR_PIN 23 18 | #define ORIG_X_MIN_PIN 15 19 | #define ORIG_X_MAX_PIN 14 20 | #define ORIG_X_ENABLE_PIN 27 21 | 22 | #define ORIG_Y_STEP_PIN 31 23 | #define ORIG_Y_DIR_PIN 33 24 | #define ORIG_Y_MIN_PIN 17 25 | #define ORIG_Y_MAX_PIN 16 26 | #define ORIG_Y_ENABLE_PIN 29 27 | 28 | #define ORIG_Z_STEP_PIN 37 29 | #define ORIG_Z_DIR_PIN 39 30 | #define ORIG_Z_MIN_PIN 19 31 | #define ORIG_Z_MAX_PIN 18 32 | #define ORIG_Z_ENABLE_PIN 35 33 | 34 | #define ORIG_HEATER_BED_PIN -1 35 | #define ORIG_TEMP_BED_PIN -1 36 | 37 | #define ORIG_HEATER_0_PIN 2 38 | #define ORIG_TEMP_0_PIN 8 39 | 40 | #define ORIG_HEATER_1_PIN 1 41 | #define ORIG_TEMP_1_PIN 1 42 | 43 | #define ORIG_HEATER_2_PIN -1 44 | #define ORIG_TEMP_2_PIN -1 45 | 46 | #define ORIG_E0_STEP_PIN 43 47 | #define ORIG_E0_DIR_PIN 45 48 | #define ORIG_E0_ENABLE_PIN 41 49 | 50 | #define ORIG_E1_STEP_PIN -1 51 | #define ORIG_E1_DIR_PIN -1 52 | #define ORIG_E1_ENABLE_PIN -1 53 | 54 | #define SDPOWER -1 55 | #define SDSS -1 56 | #define LED_PIN -1 57 | #define ORIG_FAN_PIN -1 58 | #define ORIG_PS_ON_PIN -1 59 | #define KILL_PIN -1 60 | #define SUICIDE_PIN -1 //PIN that has to be turned on right after start, to keep power flowing. 61 | 62 | #define LCD_PINS_RS 24 63 | #define LCD_PINS_ENABLE 22 64 | #define LCD_PINS_D4 36 65 | #define LCD_PINS_D5 34 66 | #define LCD_PINS_D6 32 67 | #define LCD_PINS_D7 30 68 | 69 | 70 | -------------------------------------------------------------------------------- /MK/src/boards/20.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 20 3 | * Sethi 3D_1 pin assignment - www.sethi3d.com.br 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 7 | 8 | #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__) 9 | #error Oops! Make sure you have 'Sethi 3D' selected from the 'Tools -> Boards' menu. 10 | #endif 11 | 12 | #if DISABLED(GEN7_VERSION) 13 | #define GEN7_VERSION 12 // v1.x 14 | #endif 15 | 16 | // X axis pins 17 | #define ORIG_X_STEP_PIN 19 18 | #define ORIG_X_DIR_PIN 18 19 | #define ORIG_X_ENABLE_PIN 24 20 | #define X_STOP_PIN 2 21 | 22 | // Y axis pins 23 | #define ORIG_Y_STEP_PIN 23 24 | #define ORIG_Y_DIR_PIN 22 25 | #define ORIG_Y_ENABLE_PIN 24 26 | #define Y_STOP_PIN 0 27 | 28 | // Z axis pins 29 | #define ORIG_Z_STEP_PIN 26 30 | #define ORIG_Z_DIR_PIN 25 31 | #define ORIG_Z_ENABLE_PIN 24 32 | #define ORIG_Z_MIN_PIN 1 33 | #define ORIG_Z_MAX_PIN 0 34 | 35 | // Extruder pins 36 | #define ORIG_E0_STEP_PIN 28 37 | #define ORIG_E0_DIR_PIN 27 38 | #define ORIG_E0_ENABLE_PIN 24 39 | 40 | #define ORIG_TEMP_0_PIN 1 41 | #define ORIG_TEMP_1_PIN -1 42 | #define ORIG_TEMP_2_PIN -1 43 | #define ORIG_TEMP_BED_PIN 2 44 | 45 | #define ORIG_HEATER_0_PIN 4 46 | #define ORIG_HEATER_1_PIN -1 47 | #define ORIG_HEATER_2_PIN -1 48 | #define ORIG_HEATER_BED_PIN 3 49 | 50 | #define KILL_PIN -1 51 | 52 | #define SDPOWER -1 53 | #define SDSS -1 // SCL pin of I2C header 54 | #define LED_PIN -1 55 | 56 | #if (GEN7_VERSION >= 13) 57 | // Gen7 v1.3 removed the fan pin 58 | #define ORIG_FAN_PIN -1 59 | #else 60 | #define ORIG_FAN_PIN 31 61 | #endif 62 | #define ORIG_PS_ON_PIN 15 63 | 64 | //All these generations of Gen7 supply thermistor power 65 | //via PS_ON, so ignore bad thermistor readings 66 | #define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE 67 | 68 | //our pin for debugging. 69 | #define DEBUG_PIN 0 70 | 71 | //our RS485 pins 72 | #define TORIG_X_ENABLE_PIN 12 73 | #define RORIG_X_ENABLE_PIN 13 74 | -------------------------------------------------------------------------------- /Documentation/Laser/README.md: -------------------------------------------------------------------------------- 1 | K40 laser rasterized images sends fast and large size commands over serial, 2 | so, the common 64 byte buffer in arduino isn't enough. 3 | 4 | You can edit "board.txt" in arduino ide, copy the "mega 2560" board declaration, call it 5 | "mega 2560 serial buffer 256" and then add a line like: 6 | 7 | ``` 8 | mega256.build.extra_flags=-DSERIAL_RX_BUFFER_SIZE=256 -DSERIAL_TX_BUFFER_SIZE=256 9 | ``` 10 | 11 | and then in the arduino ide select "mega 2560 serial buffer 256" board. 12 | 13 | 14 | In my boards.txt mega256 appears as this: 15 | 16 | ``` 17 | ############################################################## 18 | mega256.name=Arduino/Genuino Mega or Mega 2560 256 serialbuf 19 | 20 | mega256.vid.0=0x2341 21 | mega256.pid.0=0x0010 22 | mega256.vid.1=0x2341 23 | mega256.pid.1=0x0042 24 | mega256.vid.2=0x2A03 25 | mega256.pid.2=0x0010 26 | mega256.vid.3=0x2A03 27 | mega256.pid.3=0x0042 28 | mega256.vid.4=0x2341 29 | mega256.pid.4=0x0210 30 | mega256.vid.5=0x2341 31 | mega256.pid.5=0x0242 32 | 33 | mega256.upload.tool=avrdude 34 | mega256.upload.maximum_data_size=8192 35 | 36 | mega256.bootloader.tool=avrdude 37 | mega256.bootloader.low_fuses=0xFF 38 | mega256.bootloader.unlock_bits=0x3F 39 | mega256.bootloader.lock_bits=0x0F 40 | 41 | mega256.build.f_cpu=16000000L 42 | mega256.build.core=arduino 43 | mega256.build.variant=mega 44 | mega256.build.extra_flags=-DSERIAL_RX_BUFFER_SIZE=256 -DSERIAL_TX_BUFFER_SIZE=256 45 | 46 | # default board may be overridden by the cpu menu 47 | mega256.build.board=AVR_MEGA2560 48 | 49 | ## Arduino/Genuino Mega w/ ATmega2560 50 | ## ------------------------- 51 | mega256.menu.cpu.atmega2560=ATmega2560 (Mega 2560) 52 | 53 | mega256.menu.cpu.atmega2560.upload.protocol=wiring 54 | mega256.menu.cpu.atmega2560.upload.maximum_size=253952 55 | mega256.menu.cpu.atmega2560.upload.speed=115200 56 | 57 | mega256.menu.cpu.atmega2560.bootloader.high_fuses=0xD8 58 | mega256.menu.cpu.atmega2560.bootloader.extended_fuses=0xFD 59 | mega256.menu.cpu.atmega2560.bootloader.file=stk500v2/stk500boot_v2_mega2560.hex 60 | 61 | mega256.menu.cpu.atmega2560.build.mcu=atmega2560 62 | mega256.menu.cpu.atmega2560.build.board=AVR_MEGA2560 63 | ``` 64 | -------------------------------------------------------------------------------- /MK/src/sensor/flowmeter.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | /** 24 | * flowmeter.h - Flowmeter control library for Arduino - Version 1 25 | * Copyright (c) 2016 Franco (nextime) Lanza. All right reserved. 26 | * 27 | * This library is free software; you can redistribute it and/or 28 | * modify it under the terms of the GNU Lesser General Public 29 | * License as published by the Free Software Foundation; either 30 | * version 3 of the License, or (at your option) any later version. 31 | * 32 | * This library is distributed in the hope that it will be useful, 33 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 35 | * Lesser General Public License for more details. 36 | * 37 | * You should have received a copy of the GNU Lesser General Public 38 | * License along with this library; if not, write to the Free Software 39 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 40 | */ 41 | 42 | #ifndef FLOWMETER_H 43 | #define FLOWMETER_H 44 | 45 | #define FLOWMETER_CALIBRATION (FLOWMETER_MAXFREQ / FLOWMETER_MAXFLOW) 46 | 47 | #if ENABLED(FLOWMETER_SENSOR) 48 | void flowrate_manage(); 49 | void flow_init(); 50 | float get_flowrate(); 51 | #endif 52 | 53 | #endif // FLOWMETER_H 54 | -------------------------------------------------------------------------------- /MK/src/boards/316.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 316 3 | * PiBot Controller Rev2.0 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 7 | #define BOARD_NAME "PiBot R2" 8 | 9 | #ifndef __AVR_ATmega2560__ 10 | #error Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu. 11 | #endif 12 | 13 | #define LARGE_FLASH true 14 | 15 | // X axis pins 16 | #define ORIG_X_STEP_PIN 24 17 | #define ORIG_X_DIR_PIN 23 18 | #define ORIG_X_ENABLE_PIN 22 19 | #define ORIG_X_MIN_PIN 62 20 | #define ORIG_X_MAX_PIN 63 21 | 22 | // Y axis pins 23 | #define ORIG_Y_STEP_PIN 27 24 | #define ORIG_Y_DIR_PIN 26 25 | #define ORIG_Y_ENABLE_PIN 25 26 | #define ORIG_Y_MIN_PIN 64 27 | #define ORIG_Y_MAX_PIN 65 28 | 29 | // Z axis pins 30 | #define ORIG_Z_STEP_PIN 15 31 | #define ORIG_Z_DIR_PIN 14 32 | #define ORIG_Z_ENABLE_PIN 39 33 | #define ORIG_Z_MIN_PIN 66 34 | #define ORIG_Z_MAX_PIN 67 35 | 36 | // E axis pins 37 | #define ORIG_E0_STEP_PIN 32 38 | #define ORIG_E0_DIR_PIN 31 39 | #define ORIG_E0_ENABLE_PIN 30 40 | 41 | #define ORIG_E1_STEP_PIN 35 42 | #define ORIG_E1_DIR_PIN 34 43 | #define ORIG_E1_ENABLE_PIN 33 44 | 45 | #define SDPOWER -1 46 | #define SDSS 53 47 | #define LED_PIN -1 48 | #define SD_DETECT_PIN 40 49 | 50 | #define ORIG_FAN_PIN 6 51 | #define ORIG_FAN2_PIN 7 52 | #define ORIG_PS_ON_PIN 17 53 | 54 | #define ORIG_HEATER_0_PIN 5 55 | #define ORIG_HEATER_1_PIN 2 56 | #define ORIG_HEATER_2_PIN -1 57 | #define ORIG_HEATER_3_PIN -1 58 | 59 | #define ORIG_TEMP_0_PIN 2 // ANALOG NUMBERING 60 | #define ORIG_TEMP_1_PIN 4 // ANALOG NUMBERING 61 | #define ORIG_TEMP_2_PIN -1 // ANALOG NUMBERING 62 | #define ORIG_TEMP_3_PIN -1 // ANALOG NUMBERING 63 | 64 | #define ORIG_HEATER_BED_PIN 4 // BED 65 | #define ORIG_TEMP_BED_PIN 1 // ANALOG NUMBERING 66 | -------------------------------------------------------------------------------- /MK/src/watchdog/watchdog.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef WATCHDOG_H 24 | #define WATCHDOG_H 25 | 26 | #ifdef __SAM3X8E__ 27 | #if ENABLED(USE_WATCHDOG) 28 | // Initialize watchdog with a 4 second interrupt time 29 | void watchdog_init(); 30 | // pad the dog/reset watchdog. MUST be called at least every second after the first watchdog_init or AVR will go into emergency procedures.. 31 | void watchdog_reset(); 32 | #else 33 | // If we do not have a watchdog, then we can have empty functions which are optimized away. 34 | FORCE_INLINE void watchdog_init() {}; 35 | FORCE_INLINE void watchdog_reset() {}; 36 | #endif 37 | #else 38 | #include 39 | #if ENABLED(USE_WATCHDOG) 40 | // Initialize watchdog with a 4 second interrupt time 41 | void watchdog_init(); 42 | 43 | // Reset watchdog. MUST be called at least every 4 seconds after the 44 | // first watchdog_init or AVR will go into emergency procedures. 45 | inline void watchdog_reset() { wdt_reset(); } 46 | #else 47 | // If we do not have a watchdog, then we can have empty functions which are optimized away. 48 | FORCE_INLINE void watchdog_init() {}; 49 | FORCE_INLINE void watchdog_reset() {}; 50 | #endif 51 | #endif 52 | #endif 53 | -------------------------------------------------------------------------------- /MK/src/boards/11.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 11 3 | * Gen7 v1.1, v1.2 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 7 | 8 | #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__) 9 | #error Oops! Make sure you have 'Gen7' selected from the 'Tools -> Boards' menu. 10 | #endif 11 | 12 | #if DISABLED(GEN7_VERSION) 13 | #define GEN7_VERSION 12 // v1.x 14 | #endif 15 | 16 | //X axis pins 17 | #define ORIG_X_STEP_PIN 19 18 | #define ORIG_X_DIR_PIN 18 19 | #define ORIG_X_ENABLE_PIN 24 20 | #define X_STOP_PIN 7 21 | 22 | //Y axis pins 23 | #define ORIG_Y_STEP_PIN 23 24 | #define ORIG_Y_DIR_PIN 22 25 | #define ORIG_Y_ENABLE_PIN 24 26 | #define Y_STOP_PIN 5 27 | 28 | //Z axis pins 29 | #define ORIG_Z_STEP_PIN 26 30 | #define ORIG_Z_DIR_PIN 25 31 | #define ORIG_Z_ENABLE_PIN 24 32 | #define ORIG_Z_MIN_PIN 1 33 | #define ORIG_Z_MAX_PIN 0 34 | 35 | //extruder pins 36 | #define ORIG_E0_STEP_PIN 28 37 | #define ORIG_E0_DIR_PIN 27 38 | #define ORIG_E0_ENABLE_PIN 24 39 | 40 | #define ORIG_TEMP_0_PIN 1 41 | #define ORIG_TEMP_1_PIN -1 42 | #define ORIG_TEMP_2_PIN -1 43 | #define ORIG_TEMP_BED_PIN 2 44 | 45 | #define ORIG_HEATER_0_PIN 4 46 | #define ORIG_HEATER_1_PIN -1 47 | #define ORIG_HEATER_2_PIN -1 48 | #define ORIG_HEATER_BED_PIN 3 49 | 50 | #define KILL_PIN -1 51 | 52 | #define SDPOWER -1 53 | #define SDSS -1 // SCL pin of I2C header 54 | #define LED_PIN -1 55 | 56 | #define ORIG_FAN_PIN 31 57 | #define ORIG_PS_ON_PIN 15 58 | 59 | //All these generations of Gen7 supply thermistor power 60 | //via PS_ON, so ignore bad thermistor readings 61 | #define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE 62 | 63 | //our pin for debugging. 64 | #define DEBUG_PIN 0 65 | 66 | //our RS485 pins 67 | #define TORIG_X_ENABLE_PIN 12 68 | #define RORIG_X_ENABLE_PIN 13 69 | -------------------------------------------------------------------------------- /MK/src/boards/12.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 12 3 | * Gen7 v1.3 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 7 | 8 | #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__) 9 | #error Oops! Make sure you have 'Gen7' selected from the 'Tools -> Boards' menu. 10 | #endif 11 | 12 | #if DISABLED(GEN7_VERSION) 13 | #define GEN7_VERSION 13 // v1.x 14 | #endif 15 | 16 | //X axis pins 17 | #define ORIG_X_STEP_PIN 19 18 | #define ORIG_X_DIR_PIN 18 19 | #define ORIG_X_ENABLE_PIN 24 20 | #define X_STOP_PIN 7 21 | 22 | //Y axis pins 23 | #define ORIG_Y_STEP_PIN 23 24 | #define ORIG_Y_DIR_PIN 22 25 | #define ORIG_Y_ENABLE_PIN 24 26 | #define Y_STOP_PIN 5 27 | 28 | //Z axis pins 29 | #define ORIG_Z_STEP_PIN 26 30 | #define ORIG_Z_DIR_PIN 25 31 | #define ORIG_Z_ENABLE_PIN 24 32 | #define ORIG_Z_MIN_PIN 1 33 | #define ORIG_Z_MAX_PIN 0 34 | 35 | //extruder pins 36 | #define ORIG_E0_STEP_PIN 28 37 | #define ORIG_E0_DIR_PIN 27 38 | #define ORIG_E0_ENABLE_PIN 24 39 | 40 | #define ORIG_TEMP_0_PIN 1 41 | #define ORIG_TEMP_1_PIN -1 42 | #define ORIG_TEMP_2_PIN -1 43 | #define ORIG_TEMP_BED_PIN 2 44 | 45 | #define ORIG_HEATER_0_PIN 4 46 | #define ORIG_HEATER_1_PIN -1 47 | #define ORIG_HEATER_2_PIN -1 48 | #define ORIG_HEATER_BED_PIN 3 49 | 50 | #define KILL_PIN -1 51 | 52 | #define SDPOWER -1 53 | #define SDSS -1 // SCL pin of I2C header 54 | #define LED_PIN -1 55 | 56 | #define ORIG_FAN_PIN -1 // Gen7 v1.3 removed the fan pin 57 | #define ORIG_PS_ON_PIN 15 58 | 59 | //All these generations of Gen7 supply thermistor power 60 | //via PS_ON, so ignore bad thermistor readings 61 | #define BOGUS_TEMPERATURE_FAILSAFE_OVERRIDE 62 | 63 | //our pin for debugging. 64 | #define DEBUG_PIN 0 65 | 66 | //our RS485 pins 67 | #define TORIG_X_ENABLE_PIN 12 68 | #define RORIG_X_ENABLE_PIN 13 69 | -------------------------------------------------------------------------------- /MK/src/boards/433.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 433 3 | * Arduino Due pin assignment 4 | * for RAMPS4DUE (http://forums.reprap.org/read.php?219,479626,page=1) 5 | ****************************************************************************************/ 6 | 7 | #define KNOWN_BOARD 8 | #define BOARD_NAME "RAMPS4DUE" 9 | 10 | #ifndef __SAM3X8E__ 11 | #error Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu. 12 | #endif 13 | 14 | #define ORIG_X_STEP_PIN 54 15 | #define ORIG_X_DIR_PIN 55 16 | #define ORIG_X_ENABLE_PIN 38 17 | #define ORIG_X_MIN_PIN 3 18 | #define ORIG_X_MAX_PIN 2 19 | 20 | #define ORIG_Y_STEP_PIN 60 21 | #define ORIG_Y_DIR_PIN 61 22 | #define ORIG_Y_ENABLE_PIN 56 23 | #define ORIG_Y_MIN_PIN 14 24 | #define ORIG_Y_MAX_PIN 15 25 | 26 | #define ORIG_Z_STEP_PIN 46 27 | #define ORIG_Z_DIR_PIN 48 28 | #define ORIG_Z_ENABLE_PIN 62 29 | #define ORIG_Z_MIN_PIN 18 30 | #define ORIG_Z_MAX_PIN 19 31 | 32 | #define Y2_STEP_PIN 36 33 | #define Y2_DIR_PIN 34 34 | #define Y2_ENABLE_PIN 30 35 | 36 | #define Z2_STEP_PIN 36 37 | #define Z2_DIR_PIN 34 38 | #define Z2_ENABLE_PIN 30 39 | 40 | #define ORIG_E0_STEP_PIN 26 41 | #define ORIG_E0_DIR_PIN 28 42 | #define ORIG_E0_ENABLE_PIN 24 43 | 44 | #define ORIG_E1_STEP_PIN 36 45 | #define ORIG_E1_DIR_PIN 34 46 | #define ORIG_E1_ENABLE_PIN 30 47 | 48 | #define ORIG_HEATER_0_PIN 10 49 | #define ORIG_HEATER_1_PIN -1 50 | #define ORIG_HEATER_2_PIN -1 51 | #define ORIG_HEATER_BED_PIN 8 // BED 52 | 53 | #define ORIG_TEMP_0_PIN 9 // ANALOG NUMBERING 54 | #define ORIG_TEMP_1_PIN -1 // ANALOG NUMBERING 55 | #define ORIG_TEMP_2_PIN -1 // ANALOG NUMBERING 56 | #define ORIG_TEMP_BED_PIN 10 // ANALOG NUMBERING 57 | 58 | #define ORIG_FAN_PIN 9 59 | #define ORIG_PS_ON_PIN 12 60 | #define SDPOWER -1 61 | #define SDSS 53 62 | #define LED_PIN 13 63 | 64 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexCrop.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexCrop.h 3 | * 4 | * The definition of class NexCrop. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * 9 | * @copyright 10 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 11 | * This program is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU General Public License as 13 | * published by the Free Software Foundation; either version 2 of 14 | * the License, or (at your option) any later version. 15 | */ 16 | 17 | #ifndef __NEXCROP_H__ 18 | #define __NEXCROP_H__ 19 | 20 | #include "NexTouch.h" 21 | #include "NexHardware.h" 22 | /** 23 | * @addtogroup Component 24 | * @{ 25 | */ 26 | 27 | /** 28 | * NexCrop component. 29 | */ 30 | class NexCrop: public NexTouch 31 | { 32 | public: /* methods */ 33 | 34 | /** 35 | * @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name); 36 | */ 37 | NexCrop(uint8_t pid, uint8_t cid, const char *name); 38 | 39 | /** 40 | * Get the number of picture. 41 | * 42 | * @param number - an output parameter to save the number of picture. 43 | * 44 | * @retval true - success. 45 | * @retval false - failed. 46 | */ 47 | bool Get_background_crop_picc(uint32_t *number); 48 | 49 | /** 50 | * Set the number of picture. 51 | * 52 | * @param number - the number of picture. 53 | * 54 | * @retval true - success. 55 | * @retval false - failed. 56 | */ 57 | bool Set_background_crop_picc(uint32_t number); 58 | 59 | /** 60 | * Get the number of picture. 61 | * 62 | * @param number - an output parameter to save the number of picture. 63 | * 64 | * @retval true - success. 65 | * @retval false - failed. 66 | */ 67 | bool getPic(uint32_t *number); 68 | 69 | /** 70 | * Set the number of picture. 71 | * 72 | * @param number - the number of picture. 73 | * 74 | * @retval true - success. 75 | * @retval false - failed. 76 | */ 77 | bool setPic(uint32_t number); 78 | }; 79 | 80 | /** 81 | * @} 82 | */ 83 | 84 | #endif /* #ifndef __NEXCROP_H__ */ 85 | -------------------------------------------------------------------------------- /MK/src/planner/qr_solve.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #include "../../base.h" 24 | 25 | #ifndef QR_SOLVE_H 26 | #define QR_SOLVE_H 27 | 28 | #if ENABLED(AUTO_BED_LEVELING_GRID) 29 | 30 | void daxpy(int n, double da, double dx[], int incx, double dy[], int incy); 31 | double ddot(int n, double dx[], int incx, double dy[], int incy); 32 | double dnrm2(int n, double x[], int incx); 33 | void dqrank(double a[], int lda, int m, int n, double tol, int* kr, 34 | int jpvt[], double qraux[]); 35 | void dqrdc(double a[], int lda, int n, int p, double qraux[], int jpvt[], 36 | double work[], int job); 37 | int dqrls(double a[], int lda, int m, int n, double tol, int* kr, double b[], 38 | double x[], double rsd[], int jpvt[], double qraux[], int itask); 39 | void dqrlss(double a[], int lda, int m, int n, int kr, double b[], double x[], 40 | double rsd[], int jpvt[], double qraux[]); 41 | int dqrsl(double a[], int lda, int n, int k, double qraux[], double y[], 42 | double qy[], double qty[], double b[], double rsd[], double ab[], int job); 43 | void dscal(int n, double sa, double x[], int incx); 44 | void dswap(int n, double x[], int incx, double y[], int incy); 45 | void qr_solve(double x[], int m, int n, double a[], double b[]); 46 | 47 | #endif // ENABLED(AUTO_BED_LEVELING_GRID) 48 | 49 | #endif // QR_SOLVE_H 50 | 51 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexPicture.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexPicture.cpp 3 | * 4 | * The implementation of class NexPicture. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * @copyright 9 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | */ 15 | 16 | #include "NexPicture.h" 17 | 18 | NexPicture::NexPicture(uint8_t pid, uint8_t cid, const char *name) 19 | :NexTouch(pid, cid, name) 20 | { 21 | } 22 | 23 | bool NexPicture::Get_background_image_pic(uint32_t *number) 24 | { 25 | String cmd = String("get "); 26 | cmd += getObjName(); 27 | cmd += ".pic"; 28 | sendCommand(cmd.c_str()); 29 | return recvRetNumber(number); 30 | } 31 | 32 | bool NexPicture::Set_background_image_pic(uint32_t number) 33 | { 34 | char buf[10] = {0}; 35 | String cmd; 36 | 37 | utoa(number, buf, 10); 38 | cmd += getObjName(); 39 | cmd += ".pic="; 40 | cmd += buf; 41 | 42 | sendCommand(cmd.c_str()); 43 | return recvRetCommandFinished(); 44 | } 45 | 46 | bool NexPicture::getPic(uint32_t *number) 47 | { 48 | String cmd = String("get "); 49 | cmd += getObjName(); 50 | cmd += ".pic"; 51 | sendCommand(cmd.c_str()); 52 | return recvRetNumber(number); 53 | } 54 | 55 | bool NexPicture::setPic(uint32_t number) 56 | { 57 | char buf[10] = {0}; 58 | String cmd; 59 | 60 | utoa(number, buf, 10); 61 | cmd += getObjName(); 62 | cmd += ".pic="; 63 | cmd += buf; 64 | 65 | sendCommand(cmd.c_str()); 66 | return recvRetCommandFinished(); 67 | } 68 | 69 | bool NexPicture::setHide() 70 | { 71 | String cmd; 72 | cmd += "vis "; 73 | cmd += getObjName(); 74 | cmd += ",0"; 75 | sendCommand(cmd.c_str()); 76 | return recvRetCommandFinished(); 77 | } 78 | 79 | bool NexPicture::setShow() 80 | { 81 | String cmd; 82 | cmd += "vis "; 83 | cmd += getObjName(); 84 | cmd += ",1"; 85 | sendCommand(cmd.c_str()); 86 | return recvRetCommandFinished(); 87 | } 88 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexTouch.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexTouch.cpp 3 | * 4 | * The implementation of class NexTouch. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * @copyright 9 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | */ 15 | #include "NexTouch.h" 16 | 17 | 18 | NexTouch::NexTouch(uint8_t pid, uint8_t cid, const char *name) 19 | :NexObject(pid, cid, name) 20 | { 21 | this->__cb_push = NULL; 22 | this->__cb_pop = NULL; 23 | this->__cbpop_ptr = NULL; 24 | this->__cbpush_ptr = NULL; 25 | } 26 | 27 | void NexTouch::attachPush(NexTouchEventCb push, void *ptr) 28 | { 29 | this->__cb_push = push; 30 | this->__cbpush_ptr = ptr; 31 | } 32 | 33 | void NexTouch::detachPush(void) 34 | { 35 | this->__cb_push = NULL; 36 | this->__cbpush_ptr = NULL; 37 | } 38 | 39 | void NexTouch::attachPop(NexTouchEventCb pop, void *ptr) 40 | { 41 | this->__cb_pop = pop; 42 | this->__cbpop_ptr = ptr; 43 | } 44 | 45 | void NexTouch::detachPop(void) 46 | { 47 | this->__cb_pop = NULL; 48 | this->__cbpop_ptr = NULL; 49 | } 50 | 51 | void NexTouch::push(void) 52 | { 53 | if (__cb_push) 54 | { 55 | __cb_push(__cbpush_ptr); 56 | } 57 | } 58 | 59 | void NexTouch::pop(void) 60 | { 61 | if (__cb_pop) 62 | { 63 | __cb_pop(__cbpop_ptr); 64 | } 65 | } 66 | 67 | void NexTouch::iterate(NexTouch **list, uint8_t pid, uint8_t cid, int32_t event) 68 | { 69 | NexTouch *e = NULL; 70 | uint16_t i = 0; 71 | 72 | if (NULL == list) 73 | { 74 | return; 75 | } 76 | 77 | for(i = 0; (e = list[i]) != NULL; i++) 78 | { 79 | if (e->getObjPid() == pid && e->getObjCid() == cid) 80 | { 81 | if (NEX_EVENT_PUSH == event) 82 | { 83 | e->push(); 84 | } 85 | else if (NEX_EVENT_POP == event) 86 | { 87 | e->pop(); 88 | } 89 | 90 | break; 91 | } 92 | } 93 | } 94 | 95 | -------------------------------------------------------------------------------- /MK/src/boards/2.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 2 3 | * Cheaptronic v1.0 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 1 7 | #define BOARD_NAME "Cheaptronic v1.0" 8 | 9 | #ifndef __AVR_ATmega2560__ 10 | #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu. 11 | #endif 12 | 13 | #define LARGE_FLASH true 14 | 15 | //X motor stepper 16 | #define ORIG_X_STEP_PIN 14 17 | #define ORIG_X_DIR_PIN 15 18 | #define ORIG_X_ENABLE_PIN 24 19 | 20 | //X endstop 21 | #define ORIG_X_MIN_PIN 3 22 | #define ORIG_X_MAX_PIN -1 23 | 24 | //Y motor stepper 25 | #define ORIG_Y_STEP_PIN 35 26 | #define ORIG_Y_DIR_PIN 36 27 | #define ORIG_Y_ENABLE_PIN 31 28 | 29 | //Y endstop 30 | #define ORIG_Y_MIN_PIN 2 31 | #define ORIG_Y_MAX_PIN -1 32 | 33 | //Z motor stepper 34 | #define ORIG_Z_STEP_PIN 40 35 | #define ORIG_Z_DIR_PIN 41 36 | #define ORIG_Z_ENABLE_PIN 37 37 | 38 | //Z endstop 39 | #define ORIG_Z_MIN_PIN 5 40 | #define ORIG_Z_MAX_PIN -1 41 | 42 | //Extruder 0 stepper 43 | #define ORIG_E0_STEP_PIN 26 44 | #define ORIG_E0_DIR_PIN 28 45 | #define ORIG_E0_ENABLE_PIN 25 46 | 47 | //Extruder 1 stepper 48 | #define ORIG_E1_STEP_PIN 33 49 | #define ORIG_E1_DIR_PIN 34 50 | #define ORIG_E1_ENABLE_PIN 30 51 | 52 | #define SDPOWER -1 53 | #define SDSS -1 54 | #define LED_PIN -1 55 | 56 | //FAN 57 | #define ORIG_FAN_PIN -1 58 | 59 | #define ORIG_PS_ON_PIN -1 60 | #define KILL_PIN -1 61 | 62 | #define ORIG_HEATER_0_PIN 19 // EXTRUDER 1 63 | #define ORIG_HEATER_1_PIN 23 // EXTRUDER 2 64 | //HeatedBad 65 | #define ORIG_HEATER_BED_PIN 22 66 | //Cheaptronic v1.0 hasent EXTRUDER 3 67 | #define ORIG_HEATER_2_PIN -1 68 | 69 | //Temperature sensors 70 | #define ORIG_TEMP_0_PIN 15 71 | #define ORIG_TEMP_1_PIN 14 72 | #define ORIG_TEMP_2_PIN -1 73 | #define ORIG_TEMP_BED_PIN 13 74 | 75 | //Cheaptronic v1.0 dont support LCD 76 | #define LCD_PINS_RS -1 77 | #define LCD_PINS_ENABLE -1 78 | #define LCD_PINS_D4 -1 79 | #define LCD_PINS_D5 -1 80 | #define LCD_PINS_D6 -1 81 | #define LCD_PINS_D7 -1 82 | 83 | //Cheaptronic v1.0 dont support keypad 84 | #define BTN_EN1 -1 85 | #define BTN_EN2 -1 86 | #define BTN_ENC -1 87 | #define BLEN_C 2 88 | #define BLEN_B 1 89 | #define BLEN_A 0 90 | 91 | //Cheaptronic v1.0 does not use this port 92 | #define SD_DETECT_PIN -1 93 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexPicture.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexPicture.h 3 | * 4 | * The definition of class NexPicture. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * 9 | * @copyright 10 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 11 | * This program is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU General Public License as 13 | * published by the Free Software Foundation; either version 2 of 14 | * the License, or (at your option) any later version. 15 | */ 16 | 17 | #ifndef __NEXPICTURE_H__ 18 | #define __NEXPICTURE_H__ 19 | 20 | #include "NexTouch.h" 21 | #include "NexHardware.h" 22 | /** 23 | * @addtogroup Component 24 | * @{ 25 | */ 26 | 27 | /** 28 | * NexPicture component. 29 | */ 30 | class NexPicture: public NexTouch 31 | { 32 | public: /* methods */ 33 | /** 34 | * @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name); 35 | */ 36 | NexPicture(uint8_t pid, uint8_t cid, const char *name); 37 | 38 | /** 39 | * Get picture's number. 40 | * 41 | * @param number - an output parameter to save picture number. 42 | * 43 | * @retval true - success. 44 | * @retval false - failed. 45 | */ 46 | bool Get_background_image_pic(uint32_t *number); 47 | 48 | /** 49 | * Set picture's number. 50 | * 51 | * @param number -the picture number. 52 | * 53 | * @retval true - success. 54 | * @retval false - failed. 55 | */ 56 | bool Set_background_image_pic(uint32_t number); 57 | 58 | /** 59 | * Get picture's number. 60 | * 61 | * @param number - an output parameter to save picture number. 62 | * 63 | * @retval true - success. 64 | * @retval false - failed. 65 | */ 66 | bool getPic(uint32_t *number); 67 | 68 | /** 69 | * Set picture's number. 70 | * 71 | * @param number -the picture number. 72 | * 73 | * @retval true - success. 74 | * @retval false - failed. 75 | */ 76 | bool setPic(uint32_t number); 77 | 78 | /** 79 | * Set Hide / Show component 80 | * 81 | * @return true if success, false for failure. 82 | */ 83 | bool setHide(); 84 | bool setShow(); 85 | }; 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | #endif /* #ifndef __NEXPICTURE_H__ */ 92 | -------------------------------------------------------------------------------- /MK/src/boards/5.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 5 - 51 3 | * Gen6 - Gen6 Deluxe 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 1 7 | #define BOARD_NAME "Gen6" 8 | 9 | #ifndef __AVR_ATmega644P__ 10 | #ifndef __AVR_ATmega1284P__ 11 | #error Oops! Make sure you have 'Sanguino' selected from the 'Tools -> Boards' menu. 12 | #endif 13 | #endif 14 | 15 | //x axis pins 16 | #define ORIG_X_STEP_PIN 15 17 | #define ORIG_X_DIR_PIN 18 18 | #define ORIG_X_ENABLE_PIN 19 19 | #define X_STOP_PIN 20 20 | 21 | //y axis pins 22 | #define ORIG_Y_STEP_PIN 23 23 | #define ORIG_Y_DIR_PIN 22 24 | #define ORIG_Y_ENABLE_PIN 24 25 | #define Y_STOP_PIN 25 26 | 27 | //z axis pins 28 | #define ORIG_Z_STEP_PIN 27 29 | #define ORIG_Z_DIR_PIN 28 30 | #define ORIG_Z_ENABLE_PIN 29 31 | #define Z_STOP_PIN 30 32 | 33 | //extruder pins 34 | #define ORIG_E0_STEP_PIN 4 //Edited @ EJE Electronics 20100715 35 | #define ORIG_E0_DIR_PIN 2 //Edited @ EJE Electronics 20100715 36 | #define ORIG_E0_ENABLE_PIN 3 //Added @ EJE Electronics 20100715 37 | #define ORIG_TEMP_0_PIN 5 //changed @ rkoeppl 20110410 38 | #define ORIG_TEMP_1_PIN -1 //changed @ rkoeppl 20110410 39 | 40 | 41 | #define ORIG_TEMP_2_PIN -1 //changed @ rkoeppl 20110410 42 | #define ORIG_HEATER_0_PIN 14 //changed @ rkoeppl 20110410 43 | #define ORIG_HEATER_1_PIN -1 44 | #define ORIG_HEATER_2_PIN -1 45 | #if MOTHERBOARD == 5 46 | #define ORIG_HEATER_BED_PIN -1 //changed @ rkoeppl 20110410 47 | #define ORIG_TEMP_BED_PIN -1 //changed @ rkoeppl 20110410 48 | #else 49 | #define ORIG_HEATER_BED_PIN 1 //changed @ rkoeppl 20110410 50 | #define ORIG_TEMP_BED_PIN 0 //changed @ rkoeppl 20110410 51 | #endif 52 | #define SDPOWER -1 53 | #define SDSS 17 54 | #define LED_PIN -1 //changed @ rkoeppl 20110410 55 | #define ORIG_FAN_PIN -1 //changed @ rkoeppl 20110410 56 | #define ORIG_PS_ON_PIN -1 //changed @ rkoeppl 20110410 57 | #define KILL_PIN -1 //changed @ drakelive 20120830 58 | //our pin for debugging. 59 | 60 | #define DEBUG_PIN 0 61 | 62 | //our RS485 pins 63 | #define TORIG_X_ENABLE_PIN 12 64 | #define RORIG_X_ENABLE_PIN 13 65 | -------------------------------------------------------------------------------- /MK/src/boards/88.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 88 3 | * 5DPrint D8 Driver board 4 | * https://bitbucket.org/makible/5dprint-d8-controller-board 5 | ****************************************************************************************/ 6 | 7 | #define KNOWN_BOARD 8 | #define AT90USB 1286 // Disable MarlinSerial etc. 9 | 10 | #ifndef __AVR_AT90USB1286__ 11 | #error Oops! Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu. 12 | #endif 13 | 14 | #define LARGE_FLASH true 15 | 16 | #define ORIG_X_STEP_PIN 0 17 | #define ORIG_X_DIR_PIN 1 18 | #define ORIG_X_ENABLE_PIN 23 19 | #define X_STOP_PIN 37 20 | 21 | #define ORIG_Y_STEP_PIN 2 22 | #define ORIG_Y_DIR_PIN 3 23 | #define ORIG_Y_ENABLE_PIN 19 24 | #define Y_STOP_PIN 36 25 | 26 | #define ORIG_Z_STEP_PIN 4 27 | #define ORIG_Z_DIR_PIN 5 28 | #define ORIG_Z_ENABLE_PIN 18 29 | #define Z_STOP_PIN 39 30 | 31 | #define ORIG_E0_STEP_PIN 6 32 | #define ORIG_E0_DIR_PIN 7 33 | #define ORIG_E0_ENABLE_PIN 17 34 | 35 | #define ORIG_HEATER_0_PIN 21 // Extruder 36 | #define ORIG_HEATER_1_PIN -1 37 | #define ORIG_HEATER_2_PIN -1 38 | #define ORIG_HEATER_BED_PIN 20 // Bed 39 | // You may need to change ORIG_FAN_PIN to 16 because Marlin isn't using fastio.h 40 | // for the fan and Teensyduino uses a different pin mapping. 41 | #define ORIG_FAN_PIN 16 // Fan 42 | 43 | #define ORIG_TEMP_0_PIN 1 // Extruder / Analog pin numbering 44 | #define ORIG_TEMP_BED_PIN 0 // Bed / Analog pin numbering 45 | 46 | #define ORIG_TEMP_1_PIN -1 47 | #define ORIG_TEMP_2_PIN -1 48 | 49 | #define SDPOWER -1 50 | #define LED_PIN -1 51 | #define ORIG_PS_ON_PIN -1 52 | #define KILL_PIN -1 53 | #define ALARM_PIN -1 54 | 55 | // The SDSS pin uses a different pin mapping from file Sd2PinMap.h 56 | #define SDSS 20 57 | 58 | // Microstepping pins 59 | // Note that the pin mapping is not from fastio.h 60 | // See Sd2PinMap.h for the pin configurations 61 | #define X_MS1_PIN 25 62 | #define X_MS2_PIN 26 63 | #define Y_MS1_PIN 9 64 | #define Y_MS2_PIN 8 65 | #define Z_MS1_PIN 7 66 | #define Z_MS2_PIN 6 67 | #define E0_MS1_PIN 5 68 | #define E0_MS2_PIN 4 69 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexVariable.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexButton.h 3 | * 4 | * The definition of class NexButton. 5 | * 6 | * @author huang xiaoming (email:) 7 | * @date 2016/9/13 8 | * 9 | * @copyright 10 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 11 | * This program is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU General Public License as 13 | * published by the Free Software Foundation; either version 2 of 14 | * the License, or (at your option) any later version. 15 | */ 16 | 17 | #ifndef __NEXVARRIABLE_H__ 18 | #define __NEXVARRIABLE_H__ 19 | 20 | #include "NexTouch.h" 21 | #include "NexHardware.h" 22 | /** 23 | * @addtogroup Component 24 | * @{ 25 | */ 26 | 27 | /** 28 | * NexButton component. 29 | * 30 | * Commonly, you want to do something after push and pop it. It is recommanded that only 31 | * call @ref NexTouch::attachPop to satisfy your purpose. 32 | * 33 | * @warning Please do not call @ref NexTouch::attachPush on this component, even though you can. 34 | */ 35 | class NexVariable: public NexTouch 36 | { 37 | public: /* methods */ 38 | 39 | /** 40 | * @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name); 41 | */ 42 | NexVariable(uint8_t pid, uint8_t cid, const char *name); 43 | 44 | /** 45 | * Get text attribute of component. 46 | * 47 | * @param buffer - buffer storing text returned. 48 | * @param len - length of buffer. 49 | * @return The real length of text returned. 50 | */ 51 | uint32_t getText(char *buffer, uint32_t len); 52 | 53 | /** 54 | * Set text attribute of component. 55 | * 56 | * @param buffer - text buffer terminated with '\0'. 57 | * @return true if success, false for failure. 58 | */ 59 | bool setText(const char *buffer); 60 | 61 | /** 62 | * Get val attribute of component 63 | * 64 | * @param number - buffer storing data retur 65 | * @return the length of the data 66 | */ 67 | uint32_t getValue(uint32_t *number); 68 | 69 | /** 70 | * Set val attribute of component 71 | * 72 | * @param number - To set up the data 73 | * @param pname - To set page name 74 | * @return true if success, false for failure 75 | */ 76 | bool setValue(uint32_t number, const char *pname = ""); 77 | }; 78 | /** 79 | * @} 80 | */ 81 | 82 | 83 | #endif /* #ifndef __NEXVARRIABLE_H__*/ 84 | -------------------------------------------------------------------------------- /MK/base.h: -------------------------------------------------------------------------------- 1 | #ifndef BASE_H 2 | #define BASE_H 3 | 4 | #include "Arduino.h" 5 | #include "pins_arduino.h" 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "src/macros.h" 15 | #include "src/types.h" 16 | #include "Boards.h" 17 | #include "src/mechanics.h" 18 | 19 | #include "Configuration_Version.h" 20 | #include "Configuration_Basic.h" 21 | #include "Configuration_Overall.h" 22 | 23 | #if MECH(CARTESIAN) 24 | #include "Configuration_Cartesian.h" 25 | #elif MECH(COREXY) 26 | #include "Configuration_Core.h" 27 | #elif MECH(COREYX) 28 | #include "Configuration_Core.h" 29 | #elif MECH(COREXZ) 30 | #include "Configuration_Core.h" 31 | #elif MECH(COREZX) 32 | #include "Configuration_Core.h" 33 | #elif MECH(DELTA) 34 | #include "Configuration_Delta.h" 35 | #elif MECH(SCARA) 36 | #include "Configuration_Scara.h" 37 | #endif 38 | 39 | #include "Configuration_Temperature.h" 40 | #include "Configuration_Feature.h" 41 | #include "Configuration_Overall.h" 42 | 43 | #if ENABLED(LASERBEAM) 44 | #include "Configuration_Laser.h" 45 | #if ENABLED(LASER_RASTER) 46 | #include "src/laser/base64/base64.h" 47 | #endif 48 | #include "src/laser/laser.h" 49 | #endif 50 | 51 | #include "src/conditionals.h" 52 | #include "src/sanitycheck.h" 53 | #include "src/HAL/HAL.h" 54 | #include "src/enum.h" 55 | 56 | #if ENABLED(MESH_BED_LEVELING) 57 | #include "src/mbl/mesh_bed_leveling.h" 58 | #endif 59 | 60 | #include "Configuration_Store.h" 61 | 62 | #include "src/language/language.h" 63 | #include "src/printcounter/printcounter.h" 64 | #include "src/MK_Main.h" 65 | #include "src/planner/planner.h" 66 | #include "src/endstop/endstops.h" 67 | #include "src/motion/stepper.h" 68 | #include "src/motion/cartesian_correction.h" 69 | #include "src/temperature/temperature.h" 70 | #include "src/sensor/flowmeter.h" 71 | #include "src/lcd/ultralcd.h" 72 | #include "src/lcd/buzzer.h" 73 | #include "src/nextion/Nextion_lcd.h" 74 | #include "src/sd/cardreader.h" 75 | #include "src/servo/servo.h" 76 | #include "src/watchdog/watchdog.h" 77 | #include "src/blinkm/blinkm.h" 78 | 79 | #if MB(ALLIGATOR) 80 | #include "src/alligator/external_dac.h" 81 | #endif 82 | 83 | #if HAS(DIGIPOTSS) 84 | #include 85 | #endif 86 | 87 | #if ENABLED(FIRMWARE_TEST) 88 | #include "src/fwtest/firmware_test.h" 89 | #endif 90 | 91 | #if ENABLED(RFID_MODULE) 92 | #include "src/mfrc522/MFRC522_serial.h" 93 | #endif 94 | 95 | #endif 96 | -------------------------------------------------------------------------------- /MK/Configuration_Store.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef CONFIGURATION_STORE_H 24 | #define CONFIGURATION_STORE_H 25 | 26 | void Config_ResetDefault(); 27 | void ConfigSD_ResetDefault(); 28 | 29 | #if DISABLED(DISABLE_M503) 30 | void Config_PrintSettings(bool forReplay = false); 31 | void ConfigSD_PrintSettings(bool forReplay = false); 32 | #else 33 | FORCE_INLINE void Config_PrintSettings(bool forReplay = false) {} 34 | FORCE_INLINE void ConfigSD_PrintSettings(bool forReplay = false) {} 35 | #endif 36 | 37 | #if ENABLED(EEPROM_SETTINGS) 38 | void Config_StoreSettings(); 39 | void Config_RetrieveSettings(); 40 | #else 41 | FORCE_INLINE void Config_StoreSettings() {} 42 | FORCE_INLINE void Config_RetrieveSettings() { Config_ResetDefault(); Config_PrintSettings(); } 43 | #endif 44 | 45 | #if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS) 46 | #define CFG_SD_MAX_KEY_LEN 3+1 // icrease this if you add key name longer than the actual value. 47 | #define CFG_SD_MAX_VALUE_LEN 10+1 // this should be enought for int, long and float if you need to retrive strings increase this carefully 48 | //(11 = strlen("4294967295")+1) (4294967295 = (2^32)-1) (32 = the num of bits of the bigger basic data scructor used) 49 | //If yuou need to save string increase this to strlen("YOUR LONGER STRING")+1 50 | void ConfigSD_StoreSettings(); 51 | void ConfigSD_RetrieveSettings(bool addValue = false); 52 | int ConfigSD_KeyIndex(char *key); 53 | #else 54 | FORCE_INLINE void ConfigSD_RetrieveSettings() { ConfigSD_ResetDefault(); } 55 | #endif 56 | 57 | #endif //CONFIGURATION_STORE_H 58 | -------------------------------------------------------------------------------- /MK/src/digipot/digipot_mcp4451.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #include "../../base.h" 24 | 25 | #if ENABLED(DIGIPOT_I2C) 26 | 27 | #include "Stream.h" 28 | #include "utility/twi.h" 29 | #include "Wire.h" 30 | 31 | #include "digipot_mcp4451.h" 32 | 33 | static byte current_to_wiper(float current) { 34 | return byte(ceil(float((DIGIPOT_I2C_FACTOR * current)))); 35 | } 36 | 37 | static void i2c_send(byte addr, byte a, byte b) { 38 | Wire.beginTransmission(addr); 39 | Wire.write(a); 40 | Wire.write(b); 41 | Wire.endTransmission(); 42 | } 43 | 44 | // This is for the MCP4451 I2C based digipot 45 | void digipot_i2c_set_current(int channel, float current) { 46 | current = min((float) max(current, 0.0f), DIGIPOT_I2C_MAX_CURRENT); 47 | // these addresses are specific to Azteeg X3 Pro, can be set to others, 48 | // In this case first digipot is at address A0=0, A1= 0, second one is at A0=0, A1= 1 49 | byte addr = 0x2C; // channel 0-3 50 | if (channel >= 4) { 51 | addr = 0x2E; // channel 4-7 52 | channel -= 4; 53 | } 54 | 55 | // Initial setup 56 | i2c_send(addr, 0x40, 0xff); 57 | i2c_send(addr, 0xA0, 0xff); 58 | 59 | // Set actual wiper value 60 | byte addresses[4] = { 0x00, 0x10, 0x60, 0x70 }; 61 | i2c_send(addr, addresses[channel], current_to_wiper(current)); 62 | } 63 | 64 | void digipot_i2c_init() { 65 | const float digipot_motor_current[] = DIGIPOT_I2C_MOTOR_CURRENTS; 66 | Wire.begin(); 67 | // setup initial currents as defined in Configuration_adv.h 68 | for (int i = 0; i < COUNT(digipot_motor_current); i++) 69 | digipot_i2c_set_current(i, digipot_motor_current[i]); 70 | } 71 | 72 | #endif //DIGIPOT_I2C 73 | -------------------------------------------------------------------------------- /MK/src/boards/702.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 702 3 | * Minitronics v1.0 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 1 7 | #define BOARD_NAME "Minitronics v1.0" 8 | 9 | #ifndef __AVR_ATmega1281__ 10 | #error Oops! Make sure you have 'Minitronics ' selected from the 'Tools -> Boards' menu. 11 | #endif 12 | 13 | #define LARGE_FLASH true 14 | 15 | #define ORIG_X_STEP_PIN 48 16 | #define ORIG_X_DIR_PIN 47 17 | #define ORIG_X_ENABLE_PIN 49 18 | #define ORIG_X_MIN_PIN 5 19 | #define ORIG_X_MAX_PIN -1 //2 //Max endstops default to disabled "-1", set to commented value to enable. 20 | 21 | #define ORIG_Y_STEP_PIN 39 // A6 22 | #define ORIG_Y_DIR_PIN 40 // A0 23 | #define ORIG_Y_ENABLE_PIN 38 24 | #define ORIG_Y_MIN_PIN 2 25 | #define ORIG_Y_MAX_PIN -1 //15 26 | 27 | #define ORIG_Z_STEP_PIN 42 // A2 28 | #define ORIG_Z_DIR_PIN 43 // A6 29 | #define ORIG_Z_ENABLE_PIN 41 // A1 30 | #define ORIG_Z_MIN_PIN 6 31 | #define ORIG_Z_MAX_PIN -1 32 | 33 | #define ORIG_E0_STEP_PIN 45 34 | #define ORIG_E0_DIR_PIN 44 35 | #define ORIG_E0_ENABLE_PIN 27 36 | 37 | #define ORIG_E1_STEP_PIN 36 38 | #define ORIG_E1_DIR_PIN 35 39 | #define ORIG_E1_ENABLE_PIN 37 40 | 41 | #define ORIG_E2_STEP_PIN -1 42 | #define ORIG_E2_DIR_PIN -1 43 | #define ORIG_E2_ENABLE_PIN -1 44 | 45 | #define SDPOWER -1 46 | #define SDSS 53 47 | 48 | #define LED_PIN 46 49 | 50 | #define ORIG_FAN_PIN 9 51 | #define ORIG_FAN2_PIN -1 52 | #define ORIG_PS_ON_PIN -1 53 | #define KILL_PIN -1 54 | 55 | #define ORIG_HEATER_0_PIN 7 // EXTRUDER 1 56 | #define ORIG_HEATER_1_PIN 8 // EXTRUDER 2 57 | #define ORIG_HEATER_2_PIN 9 // thermo couple 58 | 59 | #if TEMP_SENSOR_0 == -1 60 | #define ORIG_TEMP_0_PIN 5 // ANALOG NUMBERING 61 | #else 62 | #define ORIG_TEMP_0_PIN 7 // ANALOG NUMBERING 63 | #endif 64 | #define ORIG_TEMP_1_PIN 6 // ANALOG NUMBERING 65 | #define ORIG_TEMP_2_PIN -1 // ANALOG NUMBERING 66 | 67 | #define ORIG_HEATER_BED_PIN 3 // BED 68 | #define ORIG_TEMP_BED_PIN 6 // ANALOG NUMBERING 69 | 70 | #define ORIG_BEEPER_PIN -1 71 | 72 | #define LCD_PINS_RS -1 73 | #define LCD_PINS_ENABLE -1 74 | #define LCD_PINS_D4 -1 75 | #define LCD_PINS_D5 -1 76 | #define LCD_PINS_D6 -1 77 | #define LCD_PINS_D7 -1 78 | 79 | //buttons are directly attached using keypad 80 | #define BTN_EN1 -1 81 | #define BTN_EN2 -1 82 | #define BTN_ENC -1 //the click 83 | 84 | #define BLEN_C 2 85 | #define BLEN_B 1 86 | #define BLEN_A 0 87 | 88 | #define SD_DETECT_PIN -1 // Megatronics does not use this port 89 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexRadio.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexRadio.cpp 3 | * 4 | * The implementation of class NexRadio. 5 | * 6 | * @author huang xiaoming (email:) 7 | * @date 2016/9/13 8 | * @copyright 9 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | */ 15 | #include "NexRadio.h" 16 | 17 | NexRadio::NexRadio(uint8_t pid, uint8_t cid, const char *name) 18 | :NexTouch(pid, cid, name) 19 | { 20 | } 21 | 22 | uint32_t NexRadio::getValue(uint32_t *number) 23 | { 24 | String cmd = String("get "); 25 | cmd += getObjName(); 26 | cmd += ".val"; 27 | sendCommand(cmd.c_str()); 28 | return recvRetNumber(number); 29 | } 30 | 31 | bool NexRadio::setValue(uint32_t number) 32 | { 33 | char buf[10] = {0}; 34 | String cmd; 35 | 36 | utoa(number, buf, 10); 37 | cmd += getObjName(); 38 | cmd += ".val="; 39 | cmd += buf; 40 | 41 | sendCommand(cmd.c_str()); 42 | return recvRetCommandFinished(); 43 | } 44 | 45 | uint32_t NexRadio::Get_background_color_bco(uint32_t *number) 46 | { 47 | String cmd; 48 | cmd += "get "; 49 | cmd += getObjName(); 50 | cmd += ".bco"; 51 | sendCommand(cmd.c_str()); 52 | return recvRetNumber(number); 53 | } 54 | 55 | bool NexRadio::Set_background_color_bco(uint32_t number) 56 | { 57 | char buf[10] = {0}; 58 | String cmd; 59 | 60 | utoa(number, buf, 10); 61 | cmd += getObjName(); 62 | cmd += ".bco="; 63 | cmd += buf; 64 | sendCommand(cmd.c_str()); 65 | 66 | cmd=""; 67 | cmd += "ref "; 68 | cmd += getObjName(); 69 | sendCommand(cmd.c_str()); 70 | return recvRetCommandFinished(); 71 | } 72 | 73 | uint32_t NexRadio::Get_font_color_pco(uint32_t *number) 74 | { 75 | String cmd; 76 | cmd += "get "; 77 | cmd += getObjName(); 78 | cmd += ".pco"; 79 | sendCommand(cmd.c_str()); 80 | return recvRetNumber(number); 81 | } 82 | 83 | bool NexRadio::Set_font_color_pco(uint32_t number) 84 | { 85 | char buf[10] = {0}; 86 | String cmd; 87 | 88 | utoa(number, buf, 10); 89 | cmd += getObjName(); 90 | cmd += ".pco="; 91 | cmd += buf; 92 | sendCommand(cmd.c_str()); 93 | 94 | cmd = ""; 95 | cmd += "ref "; 96 | cmd += getObjName(); 97 | sendCommand(cmd.c_str()); 98 | return recvRetCommandFinished(); 99 | } -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexCheckbox.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexCheckbox.cpp 3 | * 4 | * The implementation of class NexCheckbox. 5 | * 6 | * @author huang xiaoming (email:) 7 | * @date 2016/9/13 8 | * @copyright 9 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | */ 15 | #include "NexCheckbox.h" 16 | 17 | NexCheckbox::NexCheckbox(uint8_t pid, uint8_t cid, const char *name) 18 | :NexTouch(pid, cid, name) 19 | { 20 | } 21 | 22 | uint32_t NexCheckbox::getValue(uint32_t *number) 23 | { 24 | String cmd = String("get "); 25 | cmd += getObjName(); 26 | cmd += ".val"; 27 | sendCommand(cmd.c_str()); 28 | return recvRetNumber(number); 29 | } 30 | 31 | bool NexCheckbox::setValue(uint32_t number) 32 | { 33 | char buf[10] = {0}; 34 | String cmd; 35 | 36 | utoa(number, buf, 10); 37 | cmd += getObjName(); 38 | cmd += ".val="; 39 | cmd += buf; 40 | 41 | sendCommand(cmd.c_str()); 42 | return recvRetCommandFinished(); 43 | } 44 | 45 | uint32_t NexCheckbox::Get_background_color_bco(uint32_t *number) 46 | { 47 | String cmd; 48 | cmd += "get "; 49 | cmd += getObjName(); 50 | cmd += ".bco"; 51 | sendCommand(cmd.c_str()); 52 | return recvRetNumber(number); 53 | } 54 | 55 | bool NexCheckbox::Set_background_color_bco(uint32_t number) 56 | { 57 | char buf[10] = {0}; 58 | String cmd; 59 | 60 | utoa(number, buf, 10); 61 | cmd += getObjName(); 62 | cmd += ".bco="; 63 | cmd += buf; 64 | sendCommand(cmd.c_str()); 65 | 66 | cmd=""; 67 | cmd += "ref "; 68 | cmd += getObjName(); 69 | sendCommand(cmd.c_str()); 70 | return recvRetCommandFinished(); 71 | } 72 | 73 | uint32_t NexCheckbox::Get_font_color_pco(uint32_t *number) 74 | { 75 | String cmd; 76 | cmd += "get "; 77 | cmd += getObjName(); 78 | cmd += ".pco"; 79 | sendCommand(cmd.c_str()); 80 | return recvRetNumber(number); 81 | } 82 | 83 | bool NexCheckbox::Set_font_color_pco(uint32_t number) 84 | { 85 | char buf[10] = {0}; 86 | String cmd; 87 | 88 | utoa(number, buf, 10); 89 | cmd += getObjName(); 90 | cmd += ".pco="; 91 | cmd += buf; 92 | sendCommand(cmd.c_str()); 93 | 94 | cmd = ""; 95 | cmd += "ref "; 96 | cmd += getObjName(); 97 | sendCommand(cmd.c_str()); 98 | return recvRetCommandFinished(); 99 | } -------------------------------------------------------------------------------- /MK/src/boards/3.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 3 3 | * RAMPS OLD 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 1 7 | #define BOARD_NAME "RAMPS OLD" 8 | 9 | #if !defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) 10 | #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu. 11 | #endif 12 | 13 | // Uncomment the following line for RAMPS v1.0 14 | //#define RAMPS_V_1_0 15 | 16 | #define ORIG_X_STEP_PIN 26 17 | #define ORIG_X_DIR_PIN 28 18 | #define ORIG_X_ENABLE_PIN 24 19 | #define ORIG_X_MIN_PIN 3 20 | #define ORIG_X_MAX_PIN 2 21 | 22 | #define ORIG_Y_STEP_PIN 38 23 | #define ORIG_Y_DIR_PIN 40 24 | #define ORIG_Y_ENABLE_PIN 36 25 | #define ORIG_Y_MIN_PIN 16 26 | #define ORIG_Y_MAX_PIN 17 27 | 28 | #define ORIG_Z_STEP_PIN 44 29 | #define ORIG_Z_DIR_PIN 46 30 | #define ORIG_Z_ENABLE_PIN 42 31 | #define ORIG_Z_MIN_PIN 18 32 | #define ORIG_Z_MAX_PIN 19 33 | 34 | #define ORIG_E0_STEP_PIN 32 35 | #define ORIG_E0_DIR_PIN 34 36 | #define ORIG_E0_ENABLE_PIN 30 37 | 38 | #define SDPOWER 48 39 | #define SDSS 53 40 | #define LED_PIN 13 41 | #define ORIG_PS_ON_PIN -1 42 | #define KILL_PIN -1 43 | 44 | #if ENABLED(RAMPS_V_1_0) // RAMPS_V_1_0 45 | #define ORIG_HEATER_0_PIN 12 // RAMPS 1.0 46 | #define ORIG_HEATER_BED_PIN -1 // RAMPS 1.0 47 | #define ORIG_FAN_PIN 11 // RAMPS 1.0 48 | #else // RAMPS_V_1_1 or RAMPS_V_1_2 49 | #define ORIG_HEATER_0_PIN 10 // RAMPS 1.1 50 | #define ORIG_HEATER_BED_PIN 8 // RAMPS 1.1 51 | #define ORIG_FAN_PIN 9 // RAMPS 1.1 52 | #endif 53 | 54 | #define ORIG_HEATER_1_PIN -1 55 | #define ORIG_HEATER_2_PIN -1 56 | #define ORIG_TEMP_0_PIN 2 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! 57 | #define ORIG_TEMP_1_PIN -1 58 | #define ORIG_TEMP_2_PIN -1 59 | #define ORIG_TEMP_BED_PIN 1 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! 60 | 61 | // SPI for Max6675 Thermocouple 62 | #if DISABLED(SDSUPPORT) 63 | #define MAX6675_SS 66 // Do not use pin 53 if there is even the remote possibility of using Display/SD card 64 | #else 65 | #define MAX6675_SS 66 // Do not use pin 49 as this is tied to the switch inside the SD card socket to detect if there is an SD card present 66 | #endif 67 | -------------------------------------------------------------------------------- /MK/src/boards/999.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 999 3 | * Leapfrog Driver board 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 1 7 | 8 | #ifndef __AVR_ATmega1280__ 9 | #ifndef __AVR_ATmega2560__ 10 | #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu. 11 | #endif 12 | #endif 13 | 14 | #define ORIG_X_STEP_PIN 28 15 | #define ORIG_X_DIR_PIN 63 16 | #define ORIG_X_ENABLE_PIN 29 17 | #define ORIG_X_MIN_PIN 47 18 | #define ORIG_X_MAX_PIN -1 //2 //Max endstops default to disabled "-1", set to commented value to enable. 19 | 20 | #define ORIG_Y_STEP_PIN 14 // A6 21 | #define ORIG_Y_DIR_PIN 15 // A0 22 | #define ORIG_Y_ENABLE_PIN 39 23 | #define ORIG_Y_MIN_PIN 48 24 | #define ORIG_Y_MAX_PIN -1 //15 25 | 26 | #define ORIG_Z_STEP_PIN 31 // A2 27 | #define ORIG_Z_DIR_PIN 32 // A6 28 | #define ORIG_Z_ENABLE_PIN 30 // A1 29 | #define ORIG_Z_MIN_PIN 49 30 | #define ORIG_Z_MAX_PIN -1 31 | 32 | #define ORIG_E0_STEP_PIN 34 //34 33 | #define ORIG_E0_DIR_PIN 35 //35 34 | #define ORIG_E0_ENABLE_PIN 33 //33 35 | 36 | #define ORIG_E1_STEP_PIN 37 //37 37 | #define ORIG_E1_DIR_PIN 40 //40 38 | #define ORIG_E1_ENABLE_PIN 36 //36 39 | 40 | #define Y2_STEP_PIN 37 41 | #define Y2_DIR_PIN 40 42 | #define Y2_ENABLE_PIN 36 43 | 44 | #define Z2_STEP_PIN 37 45 | #define Z2_DIR_PIN 40 46 | #define Z2_ENABLE_PIN 36 47 | 48 | #define SDPOWER -1 49 | #define SDSS 11 50 | #define SD_DETECT_PIN -1 // 10 optional also used as mode pin 51 | #define LED_PIN 13 52 | #define ORIG_FAN_PIN 7 53 | #define ORIG_PS_ON_PIN -1 54 | #define KILL_PIN -1 55 | #define SOL1_PIN 16 56 | #define SOL2_PIN 17 57 | 58 | #define ORIG_HEATER_0_PIN 9 59 | #define ORIG_HEATER_1_PIN 8 // 12 60 | #define ORIG_HEATER_2_PIN 11 //-1 // 13 61 | #define ORIG_TEMP_0_PIN 13 //D27 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! 62 | #define ORIG_TEMP_1_PIN 15 // 1 63 | #define ORIG_TEMP_2_PIN -1 // 2 64 | #define ORIG_HEATER_BED_PIN 10 // 14/15 65 | #define ORIG_TEMP_BED_PIN 14 // 1,2 or I2C 66 | /* Unused (1) (2) (3) 4 5 6 7 8 9 10 11 12 13 (14) (15) (16) 17 (18) (19) (20) (21) (22) (23) 24 (25) (26) (27) 28 (29) (30) (31) */ 67 | 68 | 69 | -------------------------------------------------------------------------------- /MK/src/boards/72.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 72 3 | * Ultiboard v2.0 pin assignment 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 7 | 8 | #ifndef __AVR_ATmega2560__ 9 | #error Oops! Make sure you have 'Arduino Mega 2560' selected from the 'Tools -> Boards' menu. 10 | #endif 11 | 12 | #define ORIG_X_STEP_PIN 25 13 | #define ORIG_X_DIR_PIN 23 14 | #define X_STOP_PIN 22 15 | #define ORIG_X_ENABLE_PIN 27 16 | 17 | #define ORIG_Y_STEP_PIN 32 18 | #define ORIG_Y_DIR_PIN 33 19 | #define Y_STOP_PIN 26 20 | #define ORIG_Y_ENABLE_PIN 31 21 | 22 | #define ORIG_Z_STEP_PIN 35 23 | #define ORIG_Z_DIR_PIN 36 24 | #define Z_STOP_PIN 29 25 | #define ORIG_Z_ENABLE_PIN 34 26 | 27 | #define ORIG_HEATER_BED_PIN 4 28 | #define ORIG_TEMP_BED_PIN 10 29 | 30 | #define ORIG_HEATER_0_PIN 2 31 | #define ORIG_TEMP_0_PIN 8 32 | 33 | #define ORIG_HEATER_1_PIN 3 34 | #define ORIG_TEMP_1_PIN 9 35 | 36 | #define ORIG_HEATER_2_PIN -1 37 | #define ORIG_TEMP_2_PIN -1 38 | 39 | #define ORIG_E0_STEP_PIN 42 40 | #define ORIG_E0_DIR_PIN 43 41 | #define ORIG_E0_ENABLE_PIN 37 42 | 43 | #define ORIG_E1_STEP_PIN 49 44 | #define ORIG_E1_DIR_PIN 47 45 | #define ORIG_E1_ENABLE_PIN 48 46 | 47 | #define SDPOWER -1 48 | #define SDSS 53 49 | #define LED_PIN 8 50 | #define ORIG_FAN_PIN 7 51 | #define ORIG_PS_ON_PIN -1 52 | #define KILL_PIN -1 53 | #define SUICIDE_PIN -1 //PIN that has to be turned on right after start, to keep power flowing. 54 | #define SAFETY_TRIGGERED_PIN 28 //PIN to detect the safety circuit has triggered 55 | #define MAIN_VOLTAGE_MEASURE_PIN 14 //Analogue PIN to measure the main voltage, with a 100k - 4k7 resitor divider. 56 | 57 | #define MOTOR_CURRENT_PWM_XY_PIN 44 58 | #define MOTOR_CURRENT_PWM_Z_PIN 45 59 | #define MOTOR_CURRENT_PWM_E_PIN 46 60 | //Motor current PWM conversion, PWM value = MotorCurrentSetting * 255 / range 61 | #define MOTOR_CURRENT_PWM_RANGE 2000 62 | #define DEFAULT_PWM_MOTOR_CURRENT {1300, 1300, 1250} 63 | 64 | //arduino pin witch triggers an piezzo beeper 65 | #define ORIG_BEEPER_PIN 18 66 | 67 | #define LCD_PINS_RS 20 68 | #define LCD_PINS_ENABLE 15 69 | #define LCD_PINS_D4 14 70 | #define LCD_PINS_D5 21 71 | #define LCD_PINS_D6 5 72 | #define LCD_PINS_D7 6 73 | 74 | //buttons are directly attached 75 | #define BTN_EN1 40 76 | #define BTN_EN2 41 77 | #define BTN_ENC 19 //the click 78 | 79 | #define BLEN_C 2 80 | #define BLEN_B 1 81 | #define BLEN_A 0 82 | 83 | #define SD_DETECT_PIN 39 84 | 85 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexProgressBar.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexProgressBar.h 3 | * 4 | * The definition of class NexProgressBar. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * 9 | * @copyright 10 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 11 | * This program is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU General Public License as 13 | * published by the Free Software Foundation; either version 2 of 14 | * the License, or (at your option) any later version. 15 | */ 16 | 17 | #ifndef __NEXPROGRESSBAR_H__ 18 | #define __NEXPROGRESSBAR_H__ 19 | 20 | #include "NexTouch.h" 21 | #include "NexHardware.h" 22 | /** 23 | * @addtogroup Component 24 | * @{ 25 | */ 26 | 27 | /** 28 | * NexProgressBar component. 29 | */ 30 | class NexProgressBar: public NexObject 31 | { 32 | public: /* methods */ 33 | /** 34 | * @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name); 35 | */ 36 | NexProgressBar(uint8_t pid, uint8_t cid, const char *name); 37 | 38 | /** 39 | * Get the value of progress bar. 40 | * 41 | * @param number - an output parameter to save the value of porgress bar. 42 | * 43 | * @retval true - success. 44 | * @retval false - failed. 45 | */ 46 | bool getValue(uint32_t *number); 47 | 48 | /** 49 | * Set the value of progress bar. 50 | * 51 | * @param number - the value of progress bar. 52 | * 53 | * @retval true - success. 54 | * @retval false - failed. 55 | */ 56 | bool setValue(uint32_t number); 57 | 58 | /** 59 | * Get bco attribute of component 60 | * 61 | * @param number - buffer storing data retur 62 | * @return the length of the data 63 | */ 64 | uint32_t Get_background_color_bco(uint32_t *number); 65 | 66 | /** 67 | * Set bco attribute of component 68 | * 69 | * @param number - To set up the data 70 | * @return true if success, false for failure 71 | */ 72 | bool Set_background_color_bco(uint32_t number); 73 | 74 | /** 75 | * Get pco attribute of component 76 | * 77 | * @param number - buffer storing data retur 78 | * @return the length of the data 79 | */ 80 | uint32_t Get_font_color_pco(uint32_t *number); 81 | 82 | /** 83 | * Set pco attribute of component 84 | * 85 | * @param number - To set up the data 86 | * @return true if success, false for failure 87 | */ 88 | bool Set_font_color_pco(uint32_t number); 89 | }; 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | #endif /* #ifndef __NEXPROGRESSBAR_H__ */ 96 | -------------------------------------------------------------------------------- /MK/src/boards/8.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 8 - 81 3 | * Teensylu 0.7 / Printrboard pin assignments (AT90USB1286) 4 | * Requires the Teensyduino software with Teensy++ 2.0 selected in Arduino IDE! 5 | http://www.pjrc.com/teensy/teensyduino.html 6 | * See http://reprap.org/wiki/Printrboard for more info 7 | ****************************************************************************************/ 8 | 9 | #define KNOWN_BOARD 1 10 | #define AT90USB 1286 // Disable MarlinSerial etc. 11 | 12 | #ifndef __AVR_AT90USB1286__ 13 | #error Oops! Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu. 14 | #endif 15 | 16 | #ifdef AT90USBxx_TEENSYPP_ASSIGNMENTS // use Teensyduino Teensy++2.0 pin assignments instead of Marlin traditional. 17 | #error These Teensylu/Printrboard assignments depend on traditional Marlin assignments, not AT90USBxx_TEENSYPP_ASSIGNMENTS in fastio.h 18 | #endif 19 | 20 | #define LARGE_FLASH true 21 | 22 | #define ORIG_X_STEP_PIN 0 23 | #define ORIG_X_DIR_PIN 1 24 | #define ORIG_X_ENABLE_PIN 39 25 | 26 | #define ORIG_Y_STEP_PIN 2 27 | #define ORIG_Y_DIR_PIN 3 28 | #define ORIG_Y_ENABLE_PIN 38 29 | 30 | #define ORIG_Z_STEP_PIN 4 31 | #define ORIG_Z_DIR_PIN 5 32 | #define ORIG_Z_ENABLE_PIN 23 33 | 34 | #define ORIG_E0_STEP_PIN 6 35 | #define ORIG_E0_DIR_PIN 7 36 | #define ORIG_E0_ENABLE_PIN 19 37 | 38 | #define ORIG_HEATER_0_PIN 21 // Extruder 39 | #define ORIG_HEATER_1_PIN -1 40 | #define ORIG_HEATER_2_PIN -1 41 | #define ORIG_HEATER_BED_PIN 20 // Bed 42 | #define ORIG_FAN_PIN 22 // Fan 43 | // You may need to change ORIG_FAN_PIN to 16 because Marlin isn't using fastio.h 44 | // for the fan and Teensyduino uses a different pin mapping. 45 | 46 | #if MB(TEENSYLU) // Teensylu 47 | #define X_STOP_PIN 13 48 | #define Y_STOP_PIN 14 49 | #define Z_STOP_PIN 15 50 | #define ORIG_TEMP_0_PIN 7 // Extruder / Analog pin numbering 51 | #define ORIG_TEMP_BED_PIN 6 // Bed / Analog pin numbering 52 | #else // Printrboard 53 | #define X_STOP_PIN 35 54 | #define Y_STOP_PIN 8 55 | #define Z_STOP_PIN 36 56 | #define ORIG_TEMP_0_PIN 1 // Extruder / Analog pin numbering 57 | #define ORIG_TEMP_BED_PIN 0 // Bed / Analog pin numbering 58 | #endif 59 | 60 | #define ORIG_TEMP_1_PIN -1 61 | #define ORIG_TEMP_2_PIN -1 62 | 63 | #define SDPOWER -1 64 | #define SDSS 8 65 | #define LED_PIN -1 66 | #define ORIG_PS_ON_PIN -1 67 | #define KILL_PIN -1 68 | #define ALARM_PIN -1 69 | 70 | 71 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexProgressBar.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexProgressBar.cpp 3 | * 4 | * The implementation of class NexProgressBar. 5 | * 6 | * @author Wu Pengfei (email:) 7 | * @date 2015/8/13 8 | * @copyright 9 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | */ 15 | 16 | #include "NexProgressBar.h" 17 | 18 | NexProgressBar::NexProgressBar(uint8_t pid, uint8_t cid, const char *name) 19 | :NexObject(pid, cid, name) 20 | { 21 | } 22 | 23 | bool NexProgressBar::getValue(uint32_t *number) 24 | { 25 | String cmd = String("get "); 26 | cmd += getObjName(); 27 | cmd += ".val"; 28 | sendCommand(cmd.c_str()); 29 | return recvRetNumber(number); 30 | } 31 | 32 | bool NexProgressBar::setValue(uint32_t number) 33 | { 34 | char buf[10] = {0}; 35 | String cmd; 36 | 37 | utoa(number, buf, 10); 38 | cmd += getObjName(); 39 | cmd += ".val="; 40 | cmd += buf; 41 | 42 | sendCommand(cmd.c_str()); 43 | return recvRetCommandFinished(); 44 | } 45 | 46 | uint32_t NexProgressBar::Get_background_color_bco(uint32_t *number) 47 | { 48 | String cmd; 49 | cmd += "get "; 50 | cmd += getObjName(); 51 | cmd += ".bco"; 52 | sendCommand(cmd.c_str()); 53 | return recvRetNumber(number); 54 | } 55 | 56 | bool NexProgressBar::Set_background_color_bco(uint32_t number) 57 | { 58 | char buf[10] = {0}; 59 | String cmd; 60 | 61 | utoa(number, buf, 10); 62 | cmd += getObjName(); 63 | cmd += ".bco="; 64 | cmd += buf; 65 | sendCommand(cmd.c_str()); 66 | 67 | cmd=""; 68 | cmd += "ref "; 69 | cmd += getObjName(); 70 | sendCommand(cmd.c_str()); 71 | return recvRetCommandFinished(); 72 | } 73 | 74 | uint32_t NexProgressBar::Get_font_color_pco(uint32_t *number) 75 | { 76 | String cmd; 77 | cmd += "get "; 78 | cmd += getObjName(); 79 | cmd += ".pco"; 80 | sendCommand(cmd.c_str()); 81 | return recvRetNumber(number); 82 | } 83 | 84 | bool NexProgressBar::Set_font_color_pco(uint32_t number) 85 | { 86 | char buf[10] = {0}; 87 | String cmd; 88 | 89 | utoa(number, buf, 10); 90 | cmd += getObjName(); 91 | cmd += ".pco="; 92 | cmd += buf; 93 | sendCommand(cmd.c_str()); 94 | 95 | cmd = ""; 96 | cmd += "ref "; 97 | cmd += getObjName(); 98 | sendCommand(cmd.c_str()); 99 | return recvRetCommandFinished(); 100 | } 101 | -------------------------------------------------------------------------------- /MK/src/lcd/utility.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #ifndef __UTILITY_H__ 24 | #define __UTILITY_H__ 25 | 26 | #if ENABLED(ULTRA_LCD) || ENABLED(NEXTION) 27 | 28 | // Convert unsigned int to string with 12 format 29 | char* itostr2(const uint8_t& x); 30 | 31 | // Convert signed int to rj string with 123 or -12 format 32 | char* itostr3(const int& x); 33 | 34 | // Convert unsigned int to lj string with 123 format 35 | char* itostr3left(const int& xx); 36 | 37 | // Convert signed int to rj string with _123, -123, _-12, or __-1 format 38 | char *itostr4sign(const int& x); 39 | 40 | // Convert unsigned float to string with 1.23 format 41 | char* ftostr12ns(const float& x); 42 | 43 | // Convert signed float to fixed-length string with 023.45 / -23.45 format 44 | char *ftostr32(const float& x); 45 | 46 | // Convert float to fixed-length string with +123.4 / -123.4 format 47 | char* ftostr41sign(const float& x); 48 | 49 | // Convert signed float to string (6 digit) with -1.234 / _0.000 / +1.234 format 50 | char* ftostr43sign(const float& x, char plus=' '); 51 | 52 | // Convert unsigned float to rj string with 12345 format 53 | char* ftostr5rj(const float& x); 54 | 55 | // Convert signed float to string with +1234.5 format 56 | char* ftostr51sign(const float& x); 57 | 58 | // Convert signed float to space-padded string with -_23.4_ format 59 | char* ftostr52sp(const float& x); 60 | 61 | // Convert signed float to string with +123.45 format 62 | char* ftostr52sign(const float& x); 63 | 64 | // Convert float to rj string with 123 or -12 format 65 | FORCE_INLINE char *ftostr3(const float& x) { return itostr3((int)x); } 66 | 67 | // Convert float to rj string with _123, -123, _-12, or __-1 format 68 | FORCE_INLINE char *ftostr4sign(const float& x) { return itostr4sign((int)x); } 69 | 70 | #endif // ULTRA_LCD 71 | 72 | #endif // __UTILITY_H__ 73 | -------------------------------------------------------------------------------- /MK/src/boards/10.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 10 3 | * Gen7 Alfons 4 | * These Pins are assigned for the modified GEN7 5 | * Board from Alfons3 Please review the pins and adjust it for your needs 6 | ******************************************************************************/ 7 | 8 | #define KNOWN_BOARD 9 | 10 | #if !defined(__AVR_ATmega644P__) && !defined(__AVR_ATmega644__) && !defined(__AVR_ATmega1284P__) 11 | #error Oops! Make sure you have 'Gen7' selected from the 'Tools -> Boards' menu. 12 | #endif 13 | 14 | //x axis pins 15 | #define ORIG_X_STEP_PIN 21 // different from standard GEN7 16 | #define ORIG_X_DIR_PIN 20 // different from standard GEN7 17 | #define ORIG_X_ENABLE_PIN 24 18 | #define X_STOP_PIN 0 19 | 20 | //y axis pins 21 | #define ORIG_Y_STEP_PIN 23 22 | #define ORIG_Y_DIR_PIN 22 23 | #define ORIG_Y_ENABLE_PIN 24 24 | #define Y_STOP_PIN 1 25 | 26 | //z axis pins 27 | #define ORIG_Z_STEP_PIN 26 28 | #define ORIG_Z_DIR_PIN 25 29 | #define ORIG_Z_ENABLE_PIN 24 30 | #define Z_STOP_PIN 2 31 | 32 | //extruder pins 33 | #define ORIG_E0_STEP_PIN 28 34 | #define ORIG_E0_DIR_PIN 27 35 | #define ORIG_E0_ENABLE_PIN 24 36 | 37 | #define ORIG_TEMP_0_PIN 2 38 | #define ORIG_TEMP_1_PIN -1 39 | #define ORIG_TEMP_2_PIN -1 40 | #define ORIG_TEMP_BED_PIN 1 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! (pin 34 bed) 41 | 42 | #define ORIG_HEATER_0_PIN 4 43 | #define ORIG_HEATER_1_PIN -1 44 | #define ORIG_HEATER_2_PIN -1 45 | #define ORIG_HEATER_BED_PIN 3 // (bed) 46 | 47 | #define SDPOWER -1 48 | #define SDSS 31 // SCL pin of I2C header || CS Pin for SD Card support 49 | #define LED_PIN -1 50 | 51 | #define ORIG_FAN_PIN -1 52 | #define ORIG_PS_ON_PIN 19 53 | 54 | //our pin for debugging. 55 | #define DEBUG_PIN -1 56 | 57 | //our RS485 pins 58 | //#define TORIG_X_ENABLE_PIN 12 59 | //#define RORIG_X_ENABLE_PIN 13 60 | 61 | #define ORIG_BEEPER_PIN -1 62 | #define SD_DETECT_PIN -1 63 | #define SUICIDE_PIN -1 //has to be defined; otherwise Power_off doesn't work 64 | 65 | #define KILL_PIN -1 66 | //Pins for 4bit LCD Support 67 | #define LCD_PINS_RS 18 68 | #define LCD_PINS_ENABLE 17 69 | #define LCD_PINS_D4 16 70 | #define LCD_PINS_D5 15 71 | #define LCD_PINS_D6 13 72 | #define LCD_PINS_D7 14 73 | 74 | //buttons are directly attached 75 | #define BTN_EN1 11 76 | #define BTN_EN2 10 77 | #define BTN_ENC 12 //the click 78 | 79 | 80 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexRadio.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexRadio.h 3 | * 4 | * The definition of class NexRadio. 5 | * 6 | * @author huang xiaoming (email:) 7 | * @date 2016/9/13 8 | * 9 | * @copyright 10 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 11 | * This program is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU General Public License as 13 | * published by the Free Software Foundation; either version 2 of 14 | * the License, or (at your option) any later version. 15 | */ 16 | 17 | #ifndef __NEXRADIO_H__ 18 | #define __NEXRADIO_H__ 19 | 20 | #include "NexTouch.h" 21 | #include "NexHardware.h" 22 | /** 23 | * @addtogroup Component 24 | * @{ 25 | */ 26 | 27 | /** 28 | * NexRadio component. 29 | * 30 | * Commonly, you want to do something after push and pop it. It is recommanded that only 31 | * call @ref NexTouch::attachPop to satisfy your purpose. 32 | * 33 | * @warning Please do not call @ref NexTouch::attachPush on this component, even though you can. 34 | */ 35 | class NexRadio:public NexTouch 36 | { 37 | public: /* methods */ 38 | 39 | /** 40 | * @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name); 41 | */ 42 | NexRadio(uint8_t pid, uint8_t cid, const char *name); 43 | 44 | /** 45 | * Get val attribute of component 46 | * 47 | * @param number - buffer storing data retur 48 | * @return the length of the data 49 | */ 50 | uint32_t getValue(uint32_t *number); 51 | 52 | /** 53 | * Set val attribute of component 54 | * 55 | * @param number - To set up the data 56 | * @return true if success, false for failure 57 | */ 58 | bool setValue(uint32_t number); 59 | 60 | /** 61 | * Get bco attribute of component 62 | * 63 | * @param number - buffer storing data retur 64 | * @return the length of the data 65 | */ 66 | uint32_t Get_background_color_bco(uint32_t *number); 67 | 68 | /** 69 | * Set bco attribute of component 70 | * 71 | * @param number - To set up the data 72 | * @return true if success, false for failure 73 | */ 74 | bool Set_background_color_bco(uint32_t number); 75 | 76 | /** 77 | * Get pco attribute of component 78 | * 79 | * @param number - buffer storing data retur 80 | * @return the length of the data 81 | */ 82 | uint32_t Get_font_color_pco(uint32_t *number); 83 | 84 | /** 85 | * Set pco attribute of component 86 | * 87 | * @param number - To set up the data 88 | * @return true if success, false for failure 89 | */ 90 | bool Set_font_color_pco(uint32_t number); 91 | 92 | }; 93 | /** 94 | * @} 95 | */ 96 | 97 | 98 | #endif /* #ifndef __NEXRADION_H__ */ -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexCheckbox.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexCheckbox.h 3 | * 4 | * The definition of class NexCheckbox. 5 | * 6 | * @author huang xiaoming (email:) 7 | * @date 2016/9/13 8 | * 9 | * @copyright 10 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 11 | * This program is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU General Public License as 13 | * published by the Free Software Foundation; either version 2 of 14 | * the License, or (at your option) any later version. 15 | */ 16 | 17 | #ifndef __NEXCHECKBOX_H__ 18 | #define __NEXCHECKBOX_H__ 19 | 20 | #include "NexTouch.h" 21 | #include "NexHardware.h" 22 | /** 23 | * @addtogroup Component 24 | * @{ 25 | */ 26 | 27 | /** 28 | * NexButton component. 29 | * 30 | * Commonly, you want to do something after push and pop it. It is recommanded that only 31 | * call @ref NexTouch::attachPop to satisfy your purpose. 32 | * 33 | * @warning Please do not call @ref NexTouch::attachPush on this component, even though you can. 34 | */ 35 | class NexCheckbox: public NexTouch 36 | { 37 | public: /* methods */ 38 | 39 | /** 40 | * @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name); 41 | */ 42 | NexCheckbox(uint8_t pid, uint8_t cid, const char *name); 43 | 44 | /** 45 | * Get val attribute of component 46 | * 47 | * @param number - buffer storing data retur 48 | * @return the length of the data 49 | */ 50 | uint32_t getValue(uint32_t *number); 51 | 52 | /** 53 | * Set val attribute of component 54 | * 55 | * @param number - To set up the data 56 | * @return true if success, false for failure 57 | */ 58 | bool setValue(uint32_t number); 59 | 60 | /** 61 | * Get bco attribute of component 62 | * 63 | * @param number - buffer storing data retur 64 | * @return the length of the data 65 | */ 66 | uint32_t Get_background_color_bco(uint32_t *number); 67 | 68 | /** 69 | * Set bco attribute of component 70 | * 71 | * @param number - To set up the data 72 | * @return true if success, false for failure 73 | */ 74 | bool Set_background_color_bco(uint32_t number); 75 | 76 | /** 77 | * Get pco attribute of component 78 | * 79 | * @param number - buffer storing data retur 80 | * @return the length of the data 81 | */ 82 | uint32_t Get_font_color_pco(uint32_t *number); 83 | 84 | /** 85 | * Set pco attribute of component 86 | * 87 | * @param number - To set up the data 88 | * @return true if success, false for failure 89 | */ 90 | bool Set_font_color_pco(uint32_t number); 91 | }; 92 | /** 93 | * @} 94 | */ 95 | 96 | 97 | #endif /* #ifndef __NEXCHECKBOX_H__ */ -------------------------------------------------------------------------------- /MK/src/boards/70.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 70 3 | * MegaTronics 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 1 7 | 8 | #ifndef __AVR_ATmega2560__ 9 | #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu. 10 | #endif 11 | 12 | #define LARGE_FLASH true 13 | 14 | #define ORIG_X_STEP_PIN 26 15 | #define ORIG_X_DIR_PIN 28 16 | #define ORIG_X_ENABLE_PIN 24 17 | #define ORIG_X_MIN_PIN 41 18 | #define ORIG_X_MAX_PIN 37 19 | 20 | #define ORIG_Y_STEP_PIN 60 // A6 21 | #define ORIG_Y_DIR_PIN 61 // A7 22 | #define ORIG_Y_ENABLE_PIN 22 23 | #define ORIG_Y_MIN_PIN 14 24 | #define ORIG_Y_MAX_PIN 15 25 | 26 | #define ORIG_Z_STEP_PIN 54 // A0 27 | #define ORIG_Z_DIR_PIN 55 // A1 28 | #define ORIG_Z_ENABLE_PIN 56 // A2 29 | #define ORIG_Z_MIN_PIN 18 30 | #define ORIG_Z_MAX_PIN 19 31 | 32 | #define ORIG_E0_STEP_PIN 31 33 | #define ORIG_E0_DIR_PIN 32 34 | #define ORIG_E0_ENABLE_PIN 38 35 | 36 | #define ORIG_E1_STEP_PIN 34 37 | #define ORIG_E1_DIR_PIN 36 38 | #define ORIG_E1_ENABLE_PIN 30 39 | 40 | #define SDPOWER -1 41 | #define SDSS 53 42 | #define LED_PIN 13 43 | 44 | 45 | #define ORIG_FAN_PIN 7 // IO pin. Buffer needed 46 | #define ORIG_PS_ON_PIN 12 47 | #define KILL_PIN -1 48 | 49 | #define ORIG_HEATER_0_PIN 9 // EXTRUDER 1 50 | #define ORIG_HEATER_1_PIN 8 // EXTRUDER 2 (FAN On Sprinter) 51 | #define ORIG_HEATER_2_PIN -1 52 | 53 | #if TEMP_SENSOR_0 == -1 54 | #define ORIG_TEMP_0_PIN 8 // ANALOG NUMBERING 55 | #else 56 | #define ORIG_TEMP_0_PIN 13 // ANALOG NUMBERING 57 | 58 | #endif 59 | 60 | #define ORIG_TEMP_1_PIN 15 // ANALOG NUMBERING 61 | #define ORIG_TEMP_2_PIN -1 // ANALOG NUMBERING 62 | #define ORIG_HEATER_BED_PIN 10 // BED 63 | #define ORIG_TEMP_BED_PIN 14 // ANALOG NUMBERING 64 | 65 | #define ORIG_BEEPER_PIN 33 // Beeper on AUX-4 66 | 67 | #if ENABLED(ULTRA_LCD) 68 | #if ENABLED(NEWPANEL) 69 | //arduino pin which triggers an piezzo beeper 70 | 71 | #define LCD_PINS_RS 16 72 | #define LCD_PINS_ENABLE 17 73 | #define LCD_PINS_D4 23 74 | #define LCD_PINS_D5 25 75 | #define LCD_PINS_D6 27 76 | #define LCD_PINS_D7 29 77 | 78 | //buttons are directly attached using AUX-2 79 | #define BTN_EN1 59 80 | #define BTN_EN2 64 81 | #define BTN_ENC 43 //the click 82 | 83 | #define BLEN_C 2 84 | #define BLEN_B 1 85 | #define BLEN_A 0 86 | 87 | #define SD_DETECT_PIN -1 // Ramps does not use this port 88 | #endif //NEWPANEL 89 | 90 | #endif //ULTRA_LCD 91 | 92 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexTimer.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexTimer.cpp 3 | * 4 | * The implementation of class NexTimer. 5 | * 6 | * @author huang xianming (email:) 7 | * @date 2015/8/26 8 | * @copyright 9 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 10 | * This program is free software; you can redistribute it and/or 11 | * modify it under the terms of the GNU General Public License as 12 | * published by the Free Software Foundation; either version 2 of 13 | * the License, or (at your option) any later version. 14 | */ 15 | 16 | #include "NexTimer.h" 17 | 18 | NexTimer::NexTimer(uint8_t pid, uint8_t cid, const char *name) 19 | :NexTouch(pid, cid, name) 20 | { 21 | } 22 | 23 | void NexTimer::attachTimer(NexTouchEventCb timer, void *ptr) 24 | { 25 | NexTouch::attachPop(timer, ptr); 26 | } 27 | 28 | void NexTimer::detachTimer(void) 29 | { 30 | NexTouch::detachPop(); 31 | } 32 | 33 | bool NexTimer::getCycle(uint32_t *number) 34 | { 35 | String cmd = String("get "); 36 | cmd += getObjName(); 37 | cmd += ".tim"; 38 | sendCommand(cmd.c_str()); 39 | return recvRetNumber(number); 40 | } 41 | 42 | bool NexTimer::setCycle(uint32_t number) 43 | { 44 | char buf[10] = {0}; 45 | String cmd; 46 | if (number < 50) 47 | { 48 | number = 50; 49 | } 50 | utoa(number, buf, 10); 51 | cmd += getObjName(); 52 | cmd += ".tim="; 53 | cmd += buf; 54 | 55 | sendCommand(cmd.c_str()); 56 | return recvRetCommandFinished(); 57 | } 58 | 59 | 60 | bool NexTimer::enable(void) 61 | { 62 | char buf[10] = {0}; 63 | String cmd; 64 | utoa(1, buf, 10); 65 | cmd += getObjName(); 66 | cmd += ".en="; 67 | cmd += buf; 68 | 69 | sendCommand(cmd.c_str()); 70 | return recvRetCommandFinished(); 71 | } 72 | 73 | bool NexTimer::disable(void) 74 | { 75 | char buf[10] = {0}; 76 | String cmd; 77 | utoa(0, buf, 10); 78 | cmd += getObjName(); 79 | cmd += ".en="; 80 | cmd += buf; 81 | 82 | sendCommand(cmd.c_str()); 83 | return recvRetCommandFinished(); 84 | } 85 | 86 | uint32_t NexTimer::Get_cycle_tim(uint32_t *number) 87 | { 88 | String cmd = String("get "); 89 | cmd += getObjName(); 90 | cmd += ".tim"; 91 | sendCommand(cmd.c_str()); 92 | return recvRetNumber(number); 93 | } 94 | 95 | bool NexTimer::Set_cycle_tim(uint32_t number) 96 | { 97 | char buf[10] = {0}; 98 | String cmd; 99 | if (number < 8) 100 | { 101 | number = 8; 102 | } 103 | utoa(number, buf, 10); 104 | cmd += getObjName(); 105 | cmd += ".tim="; 106 | cmd += buf; 107 | sendCommand(cmd.c_str()); 108 | 109 | cmd = ""; 110 | cmd += "ref "; 111 | cmd += getObjName(); 112 | sendCommand(cmd.c_str()); 113 | return recvRetCommandFinished(); 114 | } 115 | 116 | -------------------------------------------------------------------------------- /MK/src/watchdog/watchdog.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #include "../../base.h" 24 | 25 | #if ENABLED(USE_WATCHDOG) 26 | #include "watchdog.h" 27 | 28 | #ifdef __SAM3X8E__ 29 | // Initialize watchdog with a 4 sec interrupt time 30 | void watchdog_init() { 31 | const uint32_t wdtTicks = 256; // number of watchdog ticks @ 32768Hz/128 before the watchdog times out (max 4095) 32 | WDT_Enable(WDT, (wdtTicks << WDT_MR_WDV_Pos) | (wdtTicks << WDT_MR_WDD_Pos) | WDT_MR_WDRSTEN); // enable watchdog, reset the mcu if it times out 33 | } 34 | 35 | // Reset watchdog. MUST be called every 1s after init or avr will reset. 36 | void watchdog_reset() { 37 | WDT_Restart(WDT); 38 | } 39 | #else 40 | // Initialize watchdog with a 4 sec interrupt time 41 | void watchdog_init() { 42 | #if ENABLED(WATCHDOG_RESET_MANUAL) 43 | // We enable the watchdog timer, but only for the interrupt. 44 | // Take care, as this requires the correct order of operation, with interrupts disabled. See the datasheet of any AVR chip for details. 45 | wdt_reset(); 46 | _WD_CONTROL_REG = _BV(_WD_CHANGE_BIT) | _BV(WDE); 47 | _WD_CONTROL_REG = _BV(WDIE) | WDTO_4S; 48 | #else 49 | wdt_enable(WDTO_4S); 50 | #endif 51 | } 52 | 53 | //=========================================================================== 54 | //=================================== ISR =================================== 55 | //=========================================================================== 56 | 57 | // Watchdog timer interrupt, called if main program blocks >1sec and manual reset is enabled. 58 | #if ENABLED(WATCHDOG_RESET_MANUAL) 59 | ISR(WDT_vect) { 60 | ECHO_LM(ER, "Something is wrong, please turn off the printer."); 61 | kill(PSTR("ERR:Please Reset")); //kill blocks //16 characters so it fits on a 16x2 display 62 | while (1); //wait for user or serial reset 63 | } 64 | #endif // WATCHDOG_RESET_MANUAL 65 | #endif 66 | #endif // USE_WATCHDOG 67 | -------------------------------------------------------------------------------- /MK/src/planner/vector_3.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | /** 24 | * vector_3.cpp - Vector library for bed leveling 25 | * Copyright (c) 2012 Lars Brubaker. All right reserved. 26 | * 27 | * This library is free software; you can redistribute it and/or 28 | * modify it under the terms of the GNU Lesser General Public 29 | * License as published by the Free Software Foundation; either 30 | * version 2.1 of the License, or (at your option) any later version. 31 | * 32 | * This library is distributed in the hope that it will be useful, 33 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 35 | * Lesser General Public License for more details. 36 | * 37 | * You should have received a copy of the GNU Lesser General Public 38 | * License along with this library; if not, write to the Free Software 39 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 40 | */ 41 | 42 | #ifndef VECTOR_3_H 43 | #define VECTOR_3_H 44 | 45 | #if ENABLED(AUTO_BED_LEVELING_FEATURE) 46 | class matrix_3x3; 47 | 48 | struct vector_3 { 49 | float x, y, z; 50 | 51 | vector_3(); 52 | vector_3(float x, float y, float z); 53 | 54 | static vector_3 cross(vector_3 a, vector_3 b); 55 | 56 | vector_3 operator+(vector_3 v); 57 | vector_3 operator-(vector_3 v); 58 | void normalize(); 59 | float get_length(); 60 | vector_3 get_normal(); 61 | 62 | void debug(const char title[]); 63 | 64 | void apply_rotation(matrix_3x3 matrix); 65 | }; 66 | 67 | struct matrix_3x3 { 68 | float matrix[9]; 69 | 70 | static matrix_3x3 create_from_rows(vector_3 row_0, vector_3 row_1, vector_3 row_2); 71 | static matrix_3x3 create_look_at(vector_3 target); 72 | static matrix_3x3 transpose(matrix_3x3 original); 73 | 74 | void set_to_identity(); 75 | 76 | void debug(const char title[]); 77 | }; 78 | 79 | 80 | void apply_rotation_xyz(matrix_3x3 rotationMatrix, float& x, float& y, float& z); 81 | #endif // AUTO_BED_LEVELING_FEATURE 82 | 83 | #endif // VECTOR_3_H 84 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # MarlinKimbra 3D Printer Firmware for Arduino 3 | ## Version 4.2.9 4 | 5 | Warning, this firmware was stopped. For the new version go to https://github.com/MagoKimbra/MK4duo 6 | 7 | ### Special thanks 8 | * all Marlin8bit-developers. 9 | 10 | --- 11 | # MarlinKimbra 3D Printer Firmware 12 | * [Configuration & Compilation](/Documentation/Compilation.md) 13 | * Supported 14 | * [Features](/Documentation/Features.md) 15 | * [Hardware](/Documentation/Hardware.md) 16 | * [GCodes](/Documentation/GCodes.md) 17 | * Notes 18 | * [Auto Bed Leveling](/Documentation/BedLeveling.md) 19 | * [Filament Sensor](/Documentation/FilamentSensor.md) 20 | * [Ramps Servo Power](/Documentation/RampsServoPower.md) 21 | * [LCD Language - Font - System](Documentation/LCDLanguageFont.md) 22 | * Version 23 | * [Change Log](/Documentation/changelog.md) 24 | 25 | 26 | ## Configurator Tool Online 27 | 28 | http://marlinkimbra.it 29 | 30 | 31 | ## Quick Information 32 | 33 | This version of Marlin was made to accommodate some requests made by the community RepRap Italy http://forums.reprap.org/index.php?349 34 | 35 | The new features are: 36 | * A single Firmware for all types of printers; Cartesian, Delta, SCARA, CoreXY & CoreXZ. 37 | * The possibility of having only one hotend independently from the extruders that you have. 38 | * The addition of the 6th extruder. 39 | * Management Color Mixing Extruder 40 | * System Management MKr4 for 4 extruders width just two drivers and 8 relay. 41 | * System Management MKr6 for 6 extruders width just two drivers and 8 relay. 42 | * Management Multyextruder NPr2, 4/6 extruders with only two engines. 43 | * Management Dual Extruder DONDOLO. 44 | * Adding commands to facilitate purging of hotend. 45 | * Step per unit varied for each extruder as well as the feedrate and the acceleration. 46 | * Adding Debug Dryrun used by repetier. 47 | * Added total Power on time writed in SD CARD. 48 | * Added total Power consumption writed in SD CARD. 49 | * Added total filament printed writed in SD CARD. 50 | * Added anti extruder idle oozing system. 51 | * Added Hysteresis and Z-Wobble correction (only cartesian printers). 52 | * Added support reader TAG width MFRC522 53 | * Added Cooler and Hot Chamber 54 | * Added Laser beam and raster base64 55 | * Addes Mesh Bed Level (MBL) 56 | * Added Stop and Save for Restart (SSR) 57 | 58 | ## Credits 59 | 60 | The current MarlinKimbra dev team consists of: 61 | - MagoKimbra - Alberto Cotronei (https://github.com/MagoKimbra) 62 | - simonepri - Simone Primarosa (https://github.com/simonepri) 63 | 64 | Laser features have been added by: 65 | - Franco (nextime) Lanza (https://git.nexlab.net/u/nextime) 66 | 67 | ## License 68 | 69 | Marlin is published under the [GPL license](/Documentation/COPYING.md) because I believe in open development. 70 | Please do not use this code in products (3D printers, CNC etc) that are closed source or are crippled by a patent. 71 | -------------------------------------------------------------------------------- /MK/src/boards/83.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 83 3 | * SAV MkI pin assignments (AT90USB1286) 4 | * Requires the Teensyduino software with Teensy++ 2.0 selected in Arduino IDE! 5 | * http://www.pjrc.com/teensy/teensyduino.html 6 | * RepRap Clone Wars project board. 7 | ****************************************************************************************/ 8 | 9 | #define KNOWN_BOARD 1 10 | #define AT90USB 1286 // Disable MarlinSerial etc. 11 | 12 | #ifndef __AVR_AT90USB1286__ 13 | #error Oops! Make sure you have 'Teensy++ 2.0' selected from the 'Tools -> Boards' menu. 14 | #endif 15 | 16 | #define LARGE_FLASH true 17 | 18 | 19 | #define ORIG_X_STEP_PIN 0 20 | #define ORIG_X_DIR_PIN 1 21 | #define ORIG_X_ENABLE_PIN 39 22 | 23 | #define ORIG_Y_STEP_PIN 2 24 | #define ORIG_Y_DIR_PIN 3 25 | #define ORIG_Y_ENABLE_PIN 38 26 | 27 | #define ORIG_Z_STEP_PIN 4 28 | #define ORIG_Z_DIR_PIN 5 29 | #define ORIG_Z_ENABLE_PIN 23 30 | 31 | #define ORIG_E0_STEP_PIN 6 32 | #define ORIG_E0_DIR_PIN 7 33 | #define ORIG_E0_ENABLE_PIN 19 34 | 35 | #define ORIG_HEATER_0_PIN 21 // Extruder 36 | #define ORIG_HEATER_1_PIN -1 37 | #define ORIG_HEATER_2_PIN -1 38 | #define ORIG_HEATER_BED_PIN 20 // Bed 39 | #define ORIG_FAN_PIN 16 // Fan -- from Teensyduino environment. 40 | // For the fan and Teensyduino uses a different pin mapping. 41 | #define X_STOP_PIN 13 42 | #define Y_STOP_PIN 14 43 | #define Z_STOP_PIN 15 44 | //#define Z_STOP_PIN 36 // For inductive sensor. 45 | 46 | #define ORIG_TEMP_0_PIN 7 // Extruder / Analog pin numbering 47 | #define ORIG_TEMP_BED_PIN 6 // Bed / Analog pin numbering 48 | 49 | #define ORIG_TEMP_1_PIN -1 50 | #define ORIG_TEMP_2_PIN -1 51 | 52 | #define SDPOWER -1 53 | #define SDSS 20 // PB0 - 8 in marlin env. 54 | #define LED_PIN -1 55 | #define ORIG_PS_ON_PIN -1 56 | #define ALARM_PIN -1 57 | #define SD_DETECT_PIN -1 58 | 59 | #define ORIG_BEEPER_PIN -1 60 | #define LCD_PINS_RS -1 61 | #define LCD_PINS_ENABLE -1 62 | #define LCD_PINS_D4 -1 63 | #define LCD_PINS_D5 -1 64 | #define LCD_PINS_D6 -1 65 | #define LCD_PINS_D7 -1 66 | 67 | #if ENABLED(SAV_3DLCD) 68 | // For LCD SHIFT register LCD 69 | #define SR_DATA_PIN 1 70 | #define SR_CLK_PIN 0 71 | 72 | #define BTN_EN1 41 73 | #define BTN_EN2 40 74 | #define BTN_ENC 12 75 | 76 | #define KILL_PIN 42 // A2 = 42 - teensy = 40 77 | #define HOME_PIN -1 // A4 = marlin 44 - teensy = 42 78 | 79 | #if NUM_SERVOS > 0 80 | #define SERVO0_PIN 41 // In teensy's pin definition for pinMode (in Servo.cpp) 81 | #endif 82 | 83 | #endif 84 | 85 | -------------------------------------------------------------------------------- /MK/src/boards/705.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 705 3 | * ULTRATRONICS 4 | *****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 7 | #define BOARD_NAME "Ultratronics v1.0" 8 | 9 | #ifndef __SAM3X8E__ 10 | #error Oops! Make sure you have 'Arduino Due' selected from the 'Tools -> Boards' menu. 11 | #endif 12 | 13 | // X AXIS 14 | #define ORIG_X_STEP_PIN 35 15 | #define ORIG_X_DIR_PIN 34 16 | #define ORIG_X_ENABLE_PIN 37 17 | #define ORIG_X_MIN_PIN 31 18 | #define ORIG_X_MAX_PIN 30 19 | 20 | // Y AXIS 21 | #define ORIG_Y_STEP_PIN 22 22 | #define ORIG_Y_DIR_PIN 23 23 | #define ORIG_Y_ENABLE_PIN 33 24 | #define ORIG_Y_MIN_PIN 12 25 | #define ORIG_Y_MAX_PIN 11 26 | 27 | // Z AXIS 28 | #define ORIG_Z_STEP_PIN 25 29 | #define ORIG_Z_DIR_PIN 26 30 | #define ORIG_Z_ENABLE_PIN 24 31 | #define ORIG_Z_MIN_PIN 29 32 | #define ORIG_Z_MAX_PIN 28 33 | 34 | // E0 AXIS 35 | #define ORIG_E0_STEP_PIN 47 36 | #define ORIG_E0_DIR_PIN 46 37 | #define ORIG_E0_ENABLE_PIN 48 38 | 39 | // E1 AXIS 40 | #define ORIG_E1_STEP_PIN 44 41 | #define ORIG_E1_DIR_PIN 36 42 | #define ORIG_E1_ENABLE_PIN 45 43 | 44 | // E2 AXIS 45 | #define ORIG_E2_STEP_PIN 42 46 | #define ORIG_E2_DIR_PIN 41 47 | #define ORIG_E2_ENABLE_PIN 43 48 | 49 | // E3 AXIS 50 | #define ORIG_E3_STEP_PIN 39 51 | #define ORIG_E3_DIR_PIN 38 52 | #define ORIG_E3_ENABLE_PIN 40 53 | 54 | #define SDPOWER -1 55 | #define SDSS 59 56 | #define SD_DETECT_PIN 60 57 | #define LED_PIN -1 58 | 59 | #define ORIG_FAN_PIN 6 60 | #define ORIG_FAN2_PIN 5 61 | 62 | #define ORIG_PS_ON_PIN 32 63 | #define KILL_PIN -1 64 | #define SUICIDE_PIN -1 65 | 66 | #define ORIG_HEATER_BED_PIN 2 67 | #define ORIG_HEATER_0_PIN 3 68 | #define ORIG_HEATER_1_PIN 8 69 | #define ORIG_HEATER_2_PIN 7 70 | #define ORIG_HEATER_3_PIN 9 71 | 72 | #define ORIG_TEMP_BED_PIN 0 // ANALOG NUMBERING 73 | #define ORIG_TEMP_0_PIN 1 // ANALOG NUMBERING 74 | #define ORIG_TEMP_1_PIN 2 // ANALOG NUMBERING 75 | #define ORIG_TEMP_2_PIN 3 // ANALOG NUMBERING 76 | #define ORIG_TEMP_3_PIN 4 // ANALOG NUMBERING 77 | 78 | #define ORIG_BEEPER_PIN 27 79 | 80 | #if NUM_SERVOS > 0 81 | #define SERVO0_PIN 11 82 | #if NUM_SERVOS > 1 83 | #define SERVO1_PIN 12 84 | #endif 85 | #endif 86 | 87 | #if ENABLED(REPRAPWORLD_GRAPHICAL_LCD) 88 | 89 | #define LCD_PINS_RS 62 // CS chip select / SS chip slave select 90 | #define LCD_PINS_ENABLE 75 // SID (MOSI) 91 | #define LCD_PINS_D4 76 // SCK (CLK) clock 92 | #define ORIG_BEEPER_PIN -1 93 | 94 | #define BTN_EN1 20 95 | #define BTN_EN2 21 96 | #define BTN_ENC 64 97 | 98 | #endif // REPRAPWORLD_GRAPHICAL_LCD -------------------------------------------------------------------------------- /MK/src/boards/7.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 7 3 | * Ultimaker pin assignment 4 | ****************************************************************************************/ 5 | 6 | #define KNOWN_BOARD 7 | #define BOARD_NAME "ULTIMAKER" 8 | 9 | #ifndef __AVR_ATmega1280__ 10 | #ifndef __AVR_ATmega2560__ 11 | #error Oops! Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu. 12 | #endif 13 | #endif 14 | 15 | #define LARGE_FLASH true 16 | 17 | #define ORIG_X_STEP_PIN 25 18 | #define ORIG_X_DIR_PIN 23 19 | #define ORIG_X_MIN_PIN 22 20 | #define ORIG_X_MAX_PIN 24 21 | #define ORIG_X_ENABLE_PIN 27 22 | 23 | #define ORIG_Y_STEP_PIN 31 24 | #define ORIG_Y_DIR_PIN 33 25 | #define ORIG_Y_MIN_PIN 26 26 | #define ORIG_Y_MAX_PIN 28 27 | #define ORIG_Y_ENABLE_PIN 29 28 | 29 | #define ORIG_Z_STEP_PIN 37 30 | #define ORIG_Z_DIR_PIN 39 31 | #define ORIG_Z_MIN_PIN 30 32 | #define ORIG_Z_MAX_PIN 32 33 | #define ORIG_Z_ENABLE_PIN 35 34 | 35 | #define ORIG_HEATER_BED_PIN 4 36 | #define ORIG_TEMP_BED_PIN 10 37 | 38 | #define ORIG_HEATER_0_PIN 2 39 | #define ORIG_TEMP_0_PIN 8 40 | 41 | #define ORIG_HEATER_1_PIN 3 42 | #define ORIG_TEMP_1_PIN 9 43 | 44 | #define ORIG_HEATER_2_PIN -1 45 | #define ORIG_TEMP_2_PIN -1 46 | 47 | #define ORIG_E0_STEP_PIN 43 48 | #define ORIG_E0_DIR_PIN 45 49 | #define ORIG_E0_ENABLE_PIN 41 50 | 51 | #define ORIG_E1_STEP_PIN 49 52 | #define ORIG_E1_DIR_PIN 47 53 | #define ORIG_E1_ENABLE_PIN 48 54 | 55 | #define SDPOWER -1 56 | #define SDSS 53 57 | #define LED_PIN 13 58 | #define ORIG_FAN_PIN 7 59 | #define ORIG_PS_ON_PIN 12 60 | #define KILL_PIN -1 61 | #define SUICIDE_PIN 54 //PIN that has to be turned on right after start, to keep power flowing. 62 | 63 | #if ENABLED(ULTRA_LCD) 64 | 65 | #if ENABLED(NEWPANEL) 66 | //arduino pin witch triggers an piezzo beeper 67 | #define ORIG_BEEPER_PIN 18 68 | 69 | #define LCD_PINS_RS 20 70 | #define LCD_PINS_ENABLE 17 71 | #define LCD_PINS_D4 16 72 | #define LCD_PINS_D5 21 73 | #define LCD_PINS_D6 5 74 | #define LCD_PINS_D7 6 75 | 76 | //buttons are directly attached 77 | #define BTN_EN1 40 78 | #define BTN_EN2 42 79 | #define BTN_ENC 19 //the click 80 | 81 | #define SD_DETECT_PIN 38 82 | 83 | #else //old style panel with shift register 84 | //arduino pin witch triggers an piezzo beeper 85 | #define ORIG_BEEPER_PIN 18 86 | 87 | //buttons are attached to a shift register 88 | #define SHIFT_CLK 38 89 | #define SHIFT_LD 42 90 | #define SHIFT_OUT 40 91 | #define SHIFT_EN 17 92 | 93 | #define LCD_PINS_RS 16 94 | #define LCD_PINS_ENABLE 5 95 | #define LCD_PINS_D4 6 96 | #define LCD_PINS_D5 21 97 | #define LCD_PINS_D6 20 98 | #define LCD_PINS_D7 19 99 | 100 | #define SD_DETECT_PIN -1 101 | #endif 102 | #endif //ULTRA_LCD 103 | 104 | -------------------------------------------------------------------------------- /MK/src/endstop/endstops.h: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | /** 24 | * endstops.h - manages endstops 25 | */ 26 | 27 | #ifndef ENDSTOPS_H 28 | #define ENDSTOPS_H 29 | 30 | class Endstops { 31 | 32 | public: 33 | 34 | static bool enabled, enabled_globally; 35 | static volatile char endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_PROBE as BIT value 36 | 37 | #if ENABLED(Z_DUAL_ENDSTOPS) 38 | static uint16_t 39 | #else 40 | static byte 41 | #endif 42 | current_endstop_bits, old_endstop_bits; 43 | 44 | Endstops() {}; 45 | 46 | /** 47 | * Initialize the endstop pins 48 | */ 49 | void init(); 50 | 51 | /** 52 | * Update the endstops bits from the pins 53 | */ 54 | static void update(); 55 | 56 | /** 57 | * Print an error message reporting the position when the endstops were last hit. 58 | */ 59 | static void report_state(); // call from somewhere to create an serial error message with the locations the endstops where hit, in case they were triggered 60 | 61 | /** 62 | * Report endstop positions in response to M119 63 | */ 64 | static void M119(); 65 | 66 | // Enable / disable endstop checking globally 67 | static void enable_globally(bool onoff = true) { enabled_globally = enabled = onoff; } 68 | 69 | // Enable / disable endstop checking 70 | static void enable(bool onoff = true) { enabled = onoff; } 71 | 72 | // Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable 73 | static void not_homing() { enabled = enabled_globally; } 74 | 75 | // Clear endstops (i.e., they were hit intentionally) to suppress the report 76 | static void hit_on_purpose() { endstop_hit_bits = 0; } 77 | 78 | // Enable / disable endstop z-probe checking 79 | #if HAS(BED_PROBE) 80 | static volatile bool z_probe_enabled; 81 | static void enable_z_probe(bool onoff = true) { z_probe_enabled = onoff; } 82 | #endif 83 | 84 | private: 85 | 86 | #if ENABLED(Z_DUAL_ENDSTOPS) 87 | static void test_dual_z_endstops(EndstopEnum es1, EndstopEnum es2); 88 | #endif 89 | }; 90 | 91 | extern Endstops endstops; 92 | 93 | #endif // ENDSTOPS_H 94 | -------------------------------------------------------------------------------- /MK/src/printcounter/stopwatch.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #include "../../base.h" 24 | #include "stopwatch.h" 25 | 26 | Stopwatch::Stopwatch() { 27 | this->reset(); 28 | } 29 | 30 | bool Stopwatch::stop() { 31 | #if ENABLED(DEBUG_STOPWATCH) 32 | Stopwatch::debug(PSTR("stop")); 33 | #endif 34 | 35 | if (this->isRunning() || this->isPaused()) { 36 | this->state = STOPWATCH_STOPPED; 37 | this->stopTimestamp = millis(); 38 | return true; 39 | } 40 | else return false; 41 | } 42 | 43 | bool Stopwatch::pause() { 44 | #if ENABLED(DEBUG_STOPWATCH) 45 | Stopwatch::debug(PSTR("pause")); 46 | #endif 47 | 48 | if (this->isRunning()) { 49 | this->state = STOPWATCH_PAUSED; 50 | this->stopTimestamp = millis(); 51 | return true; 52 | } 53 | else return false; 54 | } 55 | 56 | bool Stopwatch::start() { 57 | #if ENABLED(DEBUG_STOPWATCH) 58 | Stopwatch::debug(PSTR("start")); 59 | #endif 60 | 61 | if (!this->isRunning()) { 62 | if (this->isPaused()) this->accumulator = this->duration(); 63 | else this->reset(); 64 | 65 | this->state = STOPWATCH_RUNNING; 66 | this->startTimestamp = millis(); 67 | return true; 68 | } 69 | else return false; 70 | } 71 | 72 | void Stopwatch::reset() { 73 | #if ENABLED(DEBUG_STOPWATCH) 74 | Stopwatch::debug(PSTR("reset")); 75 | #endif 76 | 77 | this->state = STOPWATCH_STOPPED; 78 | this->startTimestamp = 0; 79 | this->stopTimestamp = 0; 80 | this->accumulator = 0; 81 | } 82 | 83 | bool Stopwatch::isRunning() { 84 | return (this->state == STOPWATCH_RUNNING) ? true : false; 85 | } 86 | 87 | bool Stopwatch::isPaused() { 88 | return (this->state == STOPWATCH_PAUSED) ? true : false; 89 | } 90 | 91 | millis_t Stopwatch::duration() { 92 | return (((this->isRunning()) ? millis() : this->stopTimestamp) 93 | - this->startTimestamp) / 1000UL + this->accumulator; 94 | } 95 | 96 | #if ENABLED(DEBUG_STOPWATCH) 97 | void Stopwatch::debug(const char func[]) { 98 | if (DEBUGGING(INFO)) { 99 | SERIAL_MV("Stopwatch:", func); 100 | SERIAL_EM("()"); 101 | } 102 | } 103 | #endif 104 | -------------------------------------------------------------------------------- /MK/src/temperature/thermistornames.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Marlin 3D Printer Firmware 3 | * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] 4 | * 5 | * Based on Sprinter and grbl. 6 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | #undef THERMISTOR_NAME 24 | 25 | // Thermcouples 26 | #if THERMISTOR_ID == -3 27 | #define THERMISTOR_NAME "MAX31855" 28 | #elif THERMISTOR_ID == -2 29 | #define THERMISTOR_NAME "MAX6675" 30 | #elif THERMISTOR_ID == -1 31 | #define THERMISTOR_NAME "AD595" 32 | 33 | // Standard thermistors 34 | #elif THERMISTOR_ID == 1 35 | #define THERMISTOR_NAME "EPCOS 100K" 36 | #elif THERMISTOR_ID == 2 37 | #define THERMISTOR_NAME "ATC 204GT-2" 38 | #elif THERMISTOR_ID == 3 39 | #define THERMISTOR_NAME "Mendel-parts" 40 | #elif THERMISTOR_ID == 4 41 | #define THERMISTOR_NAME "Generic 10K" 42 | #elif THERMISTOR_ID == 5 43 | #define THERMISTOR_NAME "ATC 104GT-2" 44 | #elif THERMISTOR_ID == 6 45 | #define THERMISTOR_NAME "EPCOS (alt)" 46 | #elif THERMISTOR_ID == 7 47 | #define THERMISTOR_NAME "HW 104LAG" 48 | #elif THERMISTOR_ID == 71 49 | #define THERMISTOR_NAME "HW 104LAF" 50 | #elif THERMISTOR_ID == 8 51 | #define THERMISTOR_NAME "E3104FXT" 52 | #elif THERMISTOR_ID == 9 53 | #define THERMISTOR_NAME "GE AL03006" 54 | #elif THERMISTOR_ID == 10 55 | #define THERMISTOR_NAME "RS 198-961" 56 | #elif THERMISTOR_ID == 11 57 | #define THERMISTOR_NAME "1% beta 3950" 58 | #elif THERMISTOR_ID == 12 59 | #define THERMISTOR_NAME "E3104FXT (alt)" 60 | #elif THERMISTOR_ID == 13 61 | #define THERMISTOR_NAME "Hisens 3950" 62 | #elif THERMISTOR_ID == 20 63 | #define THERMISTOR_NAME "PT100 UltiMB" 64 | #elif THERMISTOR_ID == 60 65 | #define THERMISTOR_NAME "Makers Tool" 66 | #elif THERMISTOR_ID == 70 67 | #define THERMISTOR_NAME "Hephestos 2" 68 | 69 | // Modified thermistors 70 | #elif THERMISTOR_ID == 51 71 | #define THERMISTOR_NAME "EPCOS 1K" 72 | #elif THERMISTOR_ID == 52 73 | #define THERMISTOR_NAME "ATC204GT-2 1K" 74 | #elif THERMISTOR_ID == 55 75 | #define THERMISTOR_NAME "ATC104GT-2 1K" 76 | #elif THERMISTOR_ID == 1047 77 | #define THERMISTOR_NAME "PT1000 4K7" 78 | #elif THERMISTOR_ID == 1010 79 | #define THERMISTOR_NAME "PT1000 1K" 80 | #elif THERMISTOR_ID == 147 81 | #define THERMISTOR_NAME "PT100 4K7" 82 | #elif THERMISTOR_ID == 110 83 | #define THERMISTOR_NAME "PT100 1K" 84 | 85 | // Dummies for dev testing 86 | #elif THERMISTOR_ID == 998 87 | #define THERMISTOR_NAME "Dummy 1" 88 | #elif THERMISTOR_ID == 999 89 | #define THERMISTOR_NAME "Dummy 2" 90 | 91 | #endif // THERMISTOR_ID 92 | -------------------------------------------------------------------------------- /MK/src/HAL/HAL.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | /** 24 | * This is the main Hardware Abstraction Layer (HAL). 25 | * To make the firmware work with different processors and toolchains, 26 | * all hardware related code should be packed into the hal files. 27 | * 28 | * This program is free software: you can redistribute it and/or modify 29 | * it under the terms of the GNU General Public License as published by 30 | * the Free Software Foundation, either version 3 of the License, or 31 | * (at your option) any later version. 32 | * 33 | * This program is distributed in the hope that it will be useful, 34 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 35 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 36 | * GNU General Public License for more details. 37 | * 38 | * You should have received a copy of the GNU General Public License 39 | * along with this program. If not, see . 40 | * 41 | * 42 | * Description: *** HAL for Arduino *** 43 | * 44 | * Contributors: 45 | * Copyright (c) 2014 Bob Cousins bobcousins42@googlemail.com 46 | * Nico Tonnhofer wurstnase.reprap@gmail.com 47 | * 48 | * Copyright (c) 2015 - 2016 Alberto Cotronei @MagoKimbra 49 | * 50 | * ARDUINO_ARCH_ARM 51 | */ 52 | 53 | // -------------------------------------------------------------------------- 54 | // Includes 55 | // -------------------------------------------------------------------------- 56 | 57 | #include "../../base.h" 58 | #include "HAL.h" 59 | 60 | HAL::HAL() { 61 | // ctor 62 | } 63 | 64 | HAL::~HAL() { 65 | // dtor 66 | } 67 | 68 | // Print apparent cause of start/restart 69 | void HAL::showStartReason() { 70 | byte mcu = MCUSR; 71 | if (mcu & 1) SERIAL_EM(POWER_UP); 72 | if (mcu & 2) SERIAL_EM(EXTERNAL_RESET); 73 | if (mcu & 4) SERIAL_EM(BROWN_OUT); 74 | if (mcu & 8) SERIAL_EM(WATCHDOG); 75 | if (mcu & 32) SERIAL_EM(SOFTWARE_RESET); 76 | MCUSR = 0; 77 | } 78 | 79 | // Return available memory 80 | int HAL::getFreeRam() { 81 | int freeram = 0; 82 | InterruptProtectedBlock noInts; 83 | uint8_t * heapptr, * stackptr; 84 | heapptr = (uint8_t *)malloc(4); // get heap pointer 85 | free(heapptr); // free up the memory again (sets heapptr to 0) 86 | stackptr = (uint8_t *)(SP); // save value of stack pointer 87 | freeram = (int)stackptr-(int)heapptr; 88 | return freeram; 89 | } 90 | 91 | // Reset peripherals and cpu 92 | void HAL::resetHardware() {} 93 | -------------------------------------------------------------------------------- /MK/src/boards/90.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************************** 2 | * 90 - 91 3 | * Open Motion controller with enable based extruders 4 | * 5 | * ATMega644 6 | * 7 | * +---\/---+ 8 | * (D 0) PB0 1| |40 PA0 (AI 0 / D31) 9 | * (D 1) PB1 2| |39 PA1 (AI 1 / D30) 10 | * INT2 (D 2) PB2 3| |38 PA2 (AI 2 / D29) 11 | * PWM (D 3) PB3 4| |37 PA3 (AI 3 / D28) 12 | * PWM (D 4) PB4 5| |36 PA4 (AI 4 / D27) 13 | * MOSI (D 5) PB5 6| |35 PA5 (AI 5 / D26) 14 | * MISO (D 6) PB6 7| |34 PA6 (AI 6 / D25) 15 | * SCK (D 7) PB7 8| |33 PA7 (AI 7 / D24) 16 | * RST 9| |32 AREF 17 | * VCC 10| |31 GND 18 | * GND 11| |30 AVCC 19 | * XTAL2 12| |29 PC7 (D 23) 20 | * XTAL1 13| |28 PC6 (D 22) 21 | * RX0 (D 8) PD0 14| |27 PC5 (D 21) TDI 22 | * TX0 (D 9) PD1 15| |26 PC4 (D 20) TDO 23 | * INT0 RX1 (D 10) PD2 16| |25 PC3 (D 19) TMS 24 | * INT1 TX1 (D 11) PD3 17| |24 PC2 (D 18) TCK 25 | * PWM (D 12) PD4 18| |23 PC1 (D 17) SDA 26 | * PWM (D 13) PD5 19| |22 PC0 (D 16) SCL 27 | * PWM (D 14) PD6 20| |21 PD7 (D 15) PWM 28 | * +--------+ 29 | * 30 | ****************************************************************************************/ 31 | 32 | #define KNOWN_BOARD 1 33 | 34 | #ifndef __AVR_ATmega644__ 35 | #error Oops! Make sure you have 'SanguinoA' selected from the 'Tools -> Boards' menu. 36 | #endif 37 | 38 | #define ORIG_X_STEP_PIN 21 39 | #define ORIG_X_DIR_PIN 20 40 | #define ORIG_X_ENABLE_PIN 24 41 | #define X_STOP_PIN 0 42 | 43 | #define ORIG_Y_STEP_PIN 23 44 | #define ORIG_Y_DIR_PIN 22 45 | #define ORIG_Y_ENABLE_PIN 24 46 | #define Y_STOP_PIN 1 47 | 48 | #define ORIG_Z_STEP_PIN 26 49 | #define ORIG_Z_DIR_PIN 25 50 | #define ORIG_Z_ENABLE_PIN 24 51 | #define Z_STOP_PIN 2 52 | 53 | #define ORIG_E0_STEP_PIN 28 54 | #define ORIG_E0_DIR_PIN 27 55 | #define ORIG_E0_ENABLE_PIN 24 56 | 57 | #define ORIG_E1_STEP_PIN -1 // 19 58 | #define ORIG_E1_DIR_PIN -1 // 18 59 | #define ORIG_E1_ENABLE_PIN 24 60 | 61 | #define ORIG_E2_STEP_PIN -1 // 17 62 | #define ORIG_E2_DIR_PIN -1 // 16 63 | #define ORIG_E2_ENABLE_PIN 24 64 | 65 | #define SDPOWER -1 66 | #define SDSS 11 67 | #define SD_DETECT_PIN -1 // 10 optional also used as mode pin 68 | #define LED_PIN -1 69 | #define ORIG_FAN_PIN 3 70 | #define ORIG_PS_ON_PIN -1 71 | #define KILL_PIN -1 72 | 73 | #define ORIG_HEATER_0_PIN 4 74 | #define ORIG_HEATER_1_PIN -1 // 12 75 | #define ORIG_HEATER_2_PIN -1 // 13 76 | #define ORIG_TEMP_0_PIN 0 //D27 // MUST USE ANALOG INPUT NUMBERING NOT DIGITAL OUTPUT NUMBERING!!!!!!!!! 77 | #define ORIG_TEMP_1_PIN -1 // 1 78 | #define ORIG_TEMP_2_PIN -1 // 2 79 | #define ORIG_HEATER_BED_PIN -1 // 14/15 80 | #define ORIG_TEMP_BED_PIN -1 // 1,2 or I2C 81 | /* Unused (1) (2) (3) 4 5 6 7 8 9 10 11 12 13 (14) (15) (16) 17 (18) (19) (20) (21) (22) (23) 24 (25) (26) (27) 28 (29) (30) (31) */ 82 | 83 | 84 | -------------------------------------------------------------------------------- /MK/src/nextion/nextion_lib/NexTimer.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file NexTimer.h 3 | * 4 | * The definition of class NexTimer. 5 | * 6 | * @author huang xianming (email:) 7 | * @date 2015/8/26 8 | * 9 | * @copyright 10 | * Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n 11 | * This program is free software; you can redistribute it and/or 12 | * modify it under the terms of the GNU General Public License as 13 | * published by the Free Software Foundation; either version 2 of 14 | * the License, or (at your option) any later version. 15 | */ 16 | 17 | #ifndef __NEXTIMER_H__ 18 | #define __NEXTIMER_H__ 19 | 20 | #include "NexTouch.h" 21 | #include "NexHardware.h" 22 | /** 23 | * @addtogroup Component 24 | * @{ 25 | */ 26 | 27 | /** 28 | * NexTimer component. 29 | * 30 | * Commonly, you want to do something after set timer cycle and enable it,and the cycle value 31 | * must be greater than 50 32 | * 33 | */ 34 | class NexTimer: public NexTouch 35 | { 36 | public: /* methods */ 37 | 38 | /** 39 | * @copydoc NexObject::NexObject(uint8_t pid, uint8_t cid, const char *name); 40 | */ 41 | NexTimer(uint8_t pid, uint8_t cid, const char *name); 42 | 43 | /** 44 | * Attach an callback function of timer respond event. 45 | * 46 | * @param timer - callback called with ptr when a timer respond event occurs. 47 | * @param ptr - parameter passed into push[default:NULL]. 48 | * @return none. 49 | * 50 | * @note If calling this method multiply, the last call is valid. 51 | */ 52 | void attachTimer(NexTouchEventCb timer, void *ptr = NULL); 53 | 54 | /** 55 | * Detach an callback function. 56 | * 57 | * @return none. 58 | */ 59 | void detachTimer(void); 60 | 61 | /** 62 | * Get the value of timer cycle val. 63 | * 64 | * @param number - an output parameter to save the value of timer cycle. 65 | * 66 | * @retval true - success. 67 | * @retval false - failed. 68 | */ 69 | bool getCycle(uint32_t *number); 70 | 71 | /** 72 | * Set the value of timer cycle val. 73 | * 74 | * @param number - the value of timer cycle. 75 | * 76 | * @retval true - success. 77 | * @retval false - failed. 78 | * 79 | * @warning the cycle value must be greater than 50. 80 | */ 81 | bool setCycle(uint32_t number); 82 | 83 | /** 84 | * contorl timer enable. 85 | * 86 | * @retval true - success. 87 | * @retval false - failed. 88 | */ 89 | bool enable(void); 90 | 91 | /** 92 | * contorl timer disable. 93 | * 94 | * @retval true - success. 95 | * @retval false - failed. 96 | */ 97 | bool disable(void); 98 | 99 | /** 100 | * Get tim attribute of component 101 | * 102 | * @param number - buffer storing data retur 103 | * @return the length of the data 104 | */ 105 | uint32_t Get_cycle_tim(uint32_t *number); 106 | 107 | /** 108 | * Set tim attribute of component 109 | * 110 | * @param number - To set up the data 111 | * @return true if success, false for failure 112 | */ 113 | bool Set_cycle_tim(uint32_t number); 114 | }; 115 | /** 116 | * @} 117 | */ 118 | 119 | 120 | #endif /* #ifndef __NEXTIMER_H__ */ 121 | -------------------------------------------------------------------------------- /Documentation/Laser/K40_ramps_configs/K40_no_cooler_no_flowmeter/Configuration_Laser.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFIGURATION_LASER 2 | #define CONFIGURATION_LASER 3 | 4 | //=========================================================================== 5 | //============================= Laser Settings ============================== 6 | //=========================================================================== 7 | 8 | // The following define selects how to control the laser. 9 | // Please choose the one that matches your setup. 10 | // 1 = Single pin control - LOW when off, HIGH when on, PWM to adjust intensity 11 | // 2 = Two pin control - A firing pin for which LOW = off, HIGH = on, and a seperate intensity pin which carries a constant PWM signal and adjusts duty cycle to control intensity 12 | #define LASER_CONTROL 2 13 | 14 | // The following define to use the new HakanBasted laser_pulse method to fire laser. It should be more efficient, but it's less tested. 15 | // Thanks for it to HakanBastedt that has implemented it for Marlin at https://github.com/HakanBastedt/Marlin 16 | // Uncomment to enable it *USE AT YOUR OWN RISK*, it should work but it's *NOT WELL TESTED YET* 17 | //#define LASER_PULSE_METHOD 18 | 19 | // If your machine has laser focuser, set this to true and it will use Z axis for focus or disable it. 20 | #define LASER_HAS_FOCUS false 21 | 22 | //// In the case that the laserdriver need at least a certain level "LASER_REMAP_INTENSITY" 23 | // to give anything, the intensity can be remapped to start at "LASER_REMAP_INTENSITY" 24 | // At least some CO2-drivers need it, not sure about laserdiode drivers. 25 | #define LASER_REMAP_INTENSITY 7 26 | 27 | // Uncomment the following if your laser firing pin (not the PWM pin) for two pin control requires a HIGH signal to fire rather than a low (eg Red Sail M300 RS 3040) 28 | // #define HIGH_TO_FIRE 29 | 30 | // The following defines select which G codes tell the laser to fire. It's OK to uncomment more than one. 31 | #define LASER_FIRE_G1 10 // fire the laser on a G1 move, extinguish when the move ends 32 | #define LASER_FIRE_SPINDLE 11 // fire the laser on M3, extinguish on M5 33 | #define LASER_FIRE_E 12 // fire the laser when the E axis moves 34 | 35 | // Raster mode enables the laser to etch bitmap data at high speeds. Increases command buffer size substantially. 36 | #define LASER_RASTER 37 | #define LASER_MAX_RASTER_LINE 68 // Maximum number of base64 encoded pixels per raster gcode command 38 | #define LASER_RASTER_ASPECT_RATIO 1 // pixels aren't square on most displays, 1.33 == 4:3 aspect ratio. 39 | #define LASER_RASTER_MM_PER_PULSE 0.2 // Can be overridden by providing an R value in M649 command : M649 S17 B2 D0 R0.1 F4000 40 | 41 | // Uncomment the following if the laser cutter is equipped with a peripheral relay board 42 | // to control power to an exhaust fan, cooler pump, laser power supply, etc. 43 | //#define LASER_PERIPHERALS 44 | //#define LASER_PERIPHERALS_TIMEOUT 30000 // Number of milliseconds to wait for status signal from peripheral control board 45 | 46 | // Uncomment the following line to enable cubic bezier curve movement with the G5 code 47 | // #define G5_BEZIER 48 | 49 | // Uncomment these options for the Buildlog.net laser cutter, and other similar models 50 | #define LASER_WATTS 40.0 51 | #define LASER_DIAMETER 0.1 // milimeters 52 | #define LASER_PWM 50000 // hertz 53 | #define LASER_FOCAL_HEIGHT 74.50 // z axis position at which the laser is focused 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Documentation/Laser/K40_ramps_configs/K40_with_cooler_and_flowmeter/Configuration_Laser.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFIGURATION_LASER 2 | #define CONFIGURATION_LASER 3 | 4 | //=========================================================================== 5 | //============================= Laser Settings ============================== 6 | //=========================================================================== 7 | 8 | // The following define selects how to control the laser. 9 | // Please choose the one that matches your setup. 10 | // 1 = Single pin control - LOW when off, HIGH when on, PWM to adjust intensity 11 | // 2 = Two pin control - A firing pin for which LOW = off, HIGH = on, and a seperate intensity pin which carries a constant PWM signal and adjusts duty cycle to control intensity 12 | #define LASER_CONTROL 2 13 | 14 | // The following define to use the new HakanBasted laser_pulse method to fire laser. It should be more efficient, but it's less tested. 15 | // Thanks for it to HakanBastedt that has implemented it for Marlin at https://github.com/HakanBastedt/Marlin 16 | // Uncomment to enable it *USE AT YOUR OWN RISK*, it should work but it's *NOT WELL TESTED YET* 17 | //#define LASER_PULSE_METHOD 18 | 19 | // If your machine has laser focuser, set this to true and it will use Z axis for focus or disable it. 20 | #define LASER_HAS_FOCUS false 21 | 22 | //// In the case that the laserdriver need at least a certain level "LASER_REMAP_INTENSITY" 23 | // to give anything, the intensity can be remapped to start at "LASER_REMAP_INTENSITY" 24 | // At least some CO2-drivers need it, not sure about laserdiode drivers. 25 | #define LASER_REMAP_INTENSITY 7 26 | 27 | // Uncomment the following if your laser firing pin (not the PWM pin) for two pin control requires a HIGH signal to fire rather than a low (eg Red Sail M300 RS 3040) 28 | // #define HIGH_TO_FIRE 29 | 30 | // The following defines select which G codes tell the laser to fire. It's OK to uncomment more than one. 31 | #define LASER_FIRE_G1 10 // fire the laser on a G1 move, extinguish when the move ends 32 | #define LASER_FIRE_SPINDLE 11 // fire the laser on M3, extinguish on M5 33 | #define LASER_FIRE_E 12 // fire the laser when the E axis moves 34 | 35 | // Raster mode enables the laser to etch bitmap data at high speeds. Increases command buffer size substantially. 36 | #define LASER_RASTER 37 | #define LASER_MAX_RASTER_LINE 68 // Maximum number of base64 encoded pixels per raster gcode command 38 | #define LASER_RASTER_ASPECT_RATIO 1 // pixels aren't square on most displays, 1.33 == 4:3 aspect ratio. 39 | #define LASER_RASTER_MM_PER_PULSE 0.2 // Can be overridden by providing an R value in M649 command : M649 S17 B2 D0 R0.1 F4000 40 | 41 | // Uncomment the following if the laser cutter is equipped with a peripheral relay board 42 | // to control power to an exhaust fan, cooler pump, laser power supply, etc. 43 | //#define LASER_PERIPHERALS 44 | //#define LASER_PERIPHERALS_TIMEOUT 30000 // Number of milliseconds to wait for status signal from peripheral control board 45 | 46 | // Uncomment the following line to enable cubic bezier curve movement with the G5 code 47 | // #define G5_BEZIER 48 | 49 | // Uncomment these options for the Buildlog.net laser cutter, and other similar models 50 | #define LASER_WATTS 40.0 51 | #define LASER_DIAMETER 0.1 // milimeters 52 | #define LASER_PWM 50000 // hertz 53 | #define LASER_FOCAL_HEIGHT 74.50 // z axis position at which the laser is focused 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /MK/src/sensor/flowmeter.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * MK & MK4due 3D Printer Firmware 3 | * 4 | * Based on Marlin, Sprinter and grbl 5 | * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm 6 | * Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra 7 | * 8 | * This program is free software: you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation, either version 3 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program. If not, see . 20 | * 21 | */ 22 | 23 | /** 24 | * flowmeter.h - Flowmeter control library for Arduino - Version 1 25 | * Copyright (c) 2016 Franco (nextime) Lanza. All right reserved. 26 | * 27 | * This library is free software; you can redistribute it and/or 28 | * modify it under the terms of the GNU Lesser General Public 29 | * License as published by the Free Software Foundation; either 30 | * version 3 of the License, or (at your option) any later version. 31 | * 32 | * This library is distributed in the hope that it will be useful, 33 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 35 | * Lesser General Public License for more details. 36 | * 37 | * You should have received a copy of the GNU Lesser General Public 38 | * License along with this library; if not, write to the Free Software 39 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 40 | */ 41 | 42 | #include "../../base.h" 43 | #include 44 | 45 | #if ENABLED(FLOWMETER_SENSOR) 46 | 47 | volatile int flowrate_pulsecount; 48 | float flowrate; 49 | static millis_t flowmeter_timer = 0; 50 | static millis_t lastflow = 0; 51 | void flowrate_pulsecounter(); 52 | 53 | void flow_init() { 54 | flowrate = 0; 55 | flowrate_pulsecount = 0; 56 | pinMode(FLOWMETER_PIN, INPUT); 57 | 58 | attachInterrupt(digitalPinToInterrupt(FLOWMETER_PIN), flowrate_pulsecounter, FALLING); 59 | } 60 | 61 | void flowrate_manage() { 62 | millis_t now; 63 | now = millis(); 64 | if(ELAPSED(now, flowmeter_timer)) { 65 | detachInterrupt(digitalPinToInterrupt(FLOWMETER_PIN)); 66 | flowrate = (float)(((1000.0 / (float)((float)now - (float)lastflow)) * (float)flowrate_pulsecount) / (float)FLOWMETER_CALIBRATION); 67 | #if ENABLED(FLOWMETER_DEBUG) 68 | SERIAL_SM(DEB, "FLOWMETER DEBUG "); 69 | SERIAL_MV(" flowrate:", flowrate); 70 | SERIAL_MV(" flowrate_pulsecount:", flowrate_pulsecount); 71 | SERIAL_EMV(" CALIBRATION:", FLOWMETER_CALIBRATION); 72 | #endif 73 | flowmeter_timer = now + 1000UL; 74 | lastflow = now; 75 | flowrate_pulsecount = 0; 76 | attachInterrupt(digitalPinToInterrupt(FLOWMETER_PIN), flowrate_pulsecounter, FALLING); 77 | } 78 | } 79 | 80 | float get_flowrate() { 81 | return flowrate; 82 | } 83 | 84 | void flowrate_pulsecounter() { 85 | // Increment the pulse counter 86 | flowrate_pulsecount++; 87 | } 88 | 89 | #endif // FLOWMETER_SENSOR 90 | --------------------------------------------------------------------------------