Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
MarlinKimbra
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
MarlinKimbra
Commits
8db93807
Commit
8db93807
authored
Apr 26, 2016
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/dev' into dev
parents
8c4b09e6
1e3fc326
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
443 additions
and
67 deletions
+443
-67
GCodes.md
Documentation/GCodes.md
+1
-0
changelog.md
Documentation/changelog.md
+1
-0
Configuration_Delta.h
MK/Configuration_Delta.h
+36
-8
Configuration_Store.cpp
MK/Configuration_Store.cpp
+1
-1
MK.ino
MK/MK.ino
+2
-1
marlinkimbra_v0_7_2.HMI
MK/Nextion FW/marlinkimbra_v0_7_2.HMI
+0
-0
marlinkimbra_v0_7_2.tft
MK/Nextion FW/marlinkimbra_v0_7_2.tft
+0
-0
MK_Main.cpp
MK/module/MK_Main.cpp
+28
-10
34.h
MK/module/boards/34.h
+6
-0
35.h
MK/module/boards/35.h
+6
-0
36.h
MK/module/boards/36.h
+6
-0
37.h
MK/module/boards/37.h
+6
-0
conditionals.h
MK/module/conditionals.h
+1
-1
ultralcd.cpp
MK/module/lcd/ultralcd.cpp
+1
-1
stepper.cpp
MK/module/motion/stepper.cpp
+1
-1
NexHardware.cpp
MK/module/nextion/NexHardware.cpp
+9
-9
NexUpload.cpp
MK/module/nextion/NexUpload.cpp
+175
-0
NexUpload.h
MK/module/nextion/NexUpload.h
+135
-0
Nextion.h
MK/module/nextion/Nextion.h
+1
-0
Nextion_gfx.h
MK/module/nextion/Nextion_gfx.h
+1
-1
Nextion_lcd.cpp
MK/module/nextion/Nextion_lcd.cpp
+20
-29
Nextion_lcd.h
MK/module/nextion/Nextion_lcd.h
+2
-1
sanitycheck.h
MK/module/sanitycheck.h
+4
-4
No files found.
Documentation/GCodes.md
View file @
8db93807
...
...
@@ -45,6 +45,7 @@
*
M30 - Delete file from SD (M30 filename.g)
*
M31 - Output time since last M109 or SD card start to serial
*
M32 - Make directory
*
M35 - Upload Firmware to Nextion from SD
*
M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
*
M49 - Z probe repetability test
*
M80 - Turn on Power Supply
...
...
Documentation/changelog.md
View file @
8db93807
### Version 4.2.8
*
Add board folder with files of various board containing the pins
*
Add End time on Graphics display when SD print
*
Add M35 for upload firmware to Nextion from SD
*
Rewrite macros
*
Fix M109 so it won't wait for cooling
*
Clear code
...
...
MK/Configuration_Delta.h
View file @
8db93807
...
...
@@ -50,8 +50,36 @@
// if you want use new function comment this (using // at the start of the line)
#define DELTA_SEGMENTS_PER_SECOND 200
// NOTE: All following values for DELTA_* MUST be floating point,
// so always have a decimal point in them.
//
// Towers and rod nomenclature for the following defines:
//
// C, Y-axis
// |
// DELTA_ALPHA_CA=120° | DELTA_ALPHA_CB=120°
// |
// |______ X-axis
// / \
// / \
// / \
// / \
// A B
//
// |___| DELTA CARRIAGE OFFSET
// | \
// | \
// | \ DELTA DIAGONAL ROD
// | \
// | \ | Effector is at printer center!
// | \__|__/
// | |--| DELTA EFFECTOR OFFSET
// |----| DELTA RADIUS Calculated in fw (DELTA SMOOTH ROD OFFSET - DELTA EFFECTOR OFFSET - DELTA CARRIAGE OFFSET)
// |---------| DELTA PRINTABLE RADIUS
// |-----------| DELTA SMOOTH ROD OFFSET
// Center-to-center distance of the holes in the diagonal push rods.
#define DE
FAULT_DELTA_DIAGONAL_ROD 220.0
// mm
#define DE
LTA_DIAGONAL_ROD 220.0
// mm
// Horizontal offset from middle of printer to smooth rod center.
#define DELTA_SMOOTH_ROD_OFFSET 150.0 // mm
...
...
@@ -62,8 +90,8 @@
// Horizontal offset of the universal joints on the carriages.
#define DELTA_CARRIAGE_OFFSET 20.0 // mm
//
Bed Printer
radius
#define
BED_PRINTER_RADIUS 75
// mm
//
Delta Printable
radius
#define
DELTA_PRINTABLE_RADIUS 75.0
// mm
//Endstop Offset Adjustment - All values are in mm and must be negative (to move down away from endstop switches)
#define TOWER_A_ENDSTOP_ADJ 0 // Front Left Tower
...
...
@@ -80,7 +108,7 @@
#define TOWER_B_RADIUS_ADJ 0 //Front Right Tower
#define TOWER_C_RADIUS_ADJ 0 //Rear Tower
//Diagonal Rod Adjustment - Adj diag rod for Tower by x mm from DE
FAULT_DE
LTA_DIAGONAL_ROD value
//Diagonal Rod Adjustment - Adj diag rod for Tower by x mm from DELTA_DIAGONAL_ROD value
#define TOWER_A_DIAGROD_ADJ 0 //Front Left Tower
#define TOWER_B_DIAGROD_ADJ 0 //Front Right Tower
#define TOWER_C_DIAGROD_ADJ 0 //Rear Tower
...
...
@@ -298,10 +326,10 @@
* Travel limits after homing (units are in mm) *
* *
*****************************************************************************************/
#define X_MAX_POS
BED_PRINTER
_RADIUS
#define X_MIN_POS -
BED_PRINTER
_RADIUS
#define Y_MAX_POS
BED_PRINTER
_RADIUS
#define Y_MIN_POS -
BED_PRINTER
_RADIUS
#define X_MAX_POS
DELTA_PRINTABLE
_RADIUS
#define X_MIN_POS -
DELTA_PRINTABLE
_RADIUS
#define Y_MAX_POS
DELTA_PRINTABLE
_RADIUS
#define Y_MIN_POS -
DELTA_PRINTABLE
_RADIUS
#define Z_MAX_POS MANUAL_Z_HOME_POS
#define Z_MIN_POS 0
#define E_MIN_POS 0
...
...
MK/Configuration_Store.cpp
View file @
8db93807
...
...
@@ -543,7 +543,7 @@ void Config_ResetDefault() {
#if MECH(DELTA)
delta_radius
=
DEFAULT_DELTA_RADIUS
;
delta_diagonal_rod
=
DE
FAULT_DE
LTA_DIAGONAL_ROD
;
delta_diagonal_rod
=
DELTA_DIAGONAL_ROD
;
endstop_adj
[
0
]
=
TOWER_A_ENDSTOP_ADJ
;
endstop_adj
[
1
]
=
TOWER_B_ENDSTOP_ADJ
;
endstop_adj
[
2
]
=
TOWER_C_ENDSTOP_ADJ
;
...
...
MK/MK.ino
View file @
8db93807
...
...
@@ -2,8 +2,8 @@
* MK Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2013 MagoKimbra
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -81,6 +81,7 @@
* M30 - Delete file from SD (M30 filename.g)
* M31 - Output time since last M109 or SD card start to serial
* M32 - Make directory
* M35 - Upload Firmware to Nextion from SD
* M42 - Change pin status via gcode Use M42 Px Sy to set pin x to value y, when omitting Px the onboard led will be used.
* M48 - Measure Z_Probe repeatability. M48 [P # of points] [X position] [Y position] [V_erboseness #] [E_ngage Probe] [L # of legs of travel]
* M70 - Power consumption sensor calibration
...
...
MK/Nextion FW/marlinkimbra_v0_7_
0
.HMI
→
MK/Nextion FW/marlinkimbra_v0_7_
2
.HMI
View file @
8db93807
No preview for this file type
MK/Nextion FW/marlinkimbra_v0_7_
0
.tft
→
MK/Nextion FW/marlinkimbra_v0_7_
2
.tft
View file @
8db93807
No preview for this file type
MK/module/MK_Main.cpp
View file @
8db93807
...
...
@@ -2,8 +2,8 @@
* MK Firmware
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2013 MagoKimbra
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2013 - 2016 Alberto Cotronei @MagoKimbra
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
...
...
@@ -184,8 +184,8 @@ double printer_usage_filament;
float
diagrod_adj
[
3
]
=
{
0
};
float
saved_endstop_adj
[
3
]
=
{
0
};
float
tower_adj
[
6
]
=
{
0
};
float
delta_radius
;
// =
DEFAULT_
delta_radius;
float
delta_diagonal_rod
;
// = DE
FAULT_DE
LTA_DIAGONAL_ROD;
float
delta_radius
;
// = delta_radius;
float
delta_diagonal_rod
;
// = DELTA_DIAGONAL_ROD;
float
delta_diagonal_rod_1
;
float
delta_diagonal_rod_2
;
float
delta_diagonal_rod_3
;
...
...
@@ -2703,8 +2703,9 @@ static void clean_up_after_endstop_move() {
#endif
#if HOTENDS > 1
for
(
uint8_t
h
=
0
;
h
<
HOTENDS
;
++
h
)
{
ECHO_MV
(
" T"
,
h
);
ECHO_MV
(
":"
,
degHotend
(
h
),
1
);
ECHO_MV
(
" T"
,
(
int
)
h
);
ECHO_C
(
':'
);
ECHO_V
(
degHotend
(
h
),
1
);
ECHO_MV
(
" /"
,
degTargetHotend
(
h
),
1
);
}
#endif
...
...
@@ -2724,7 +2725,7 @@ static void clean_up_after_endstop_move() {
#endif
#if HOTENDS > 1
for
(
uint8_t
h
=
0
;
h
<
HOTENDS
;
++
h
)
{
ECHO_MV
(
" "
SERIAL_AT
,
h
);
ECHO_MV
(
" "
SERIAL_AT
,
(
int
)
h
);
ECHO_C
(
':'
);
#if ENABLED(HOTEND_WATTS)
ECHO_VM
(((
HOTEND_WATTS
)
*
getHeaterPower
(
h
))
/
127
,
"W"
);
...
...
@@ -2739,8 +2740,9 @@ static void clean_up_after_endstop_move() {
ECHO_MV
(
"C->"
,
rawBedTemp
()
/
OVERSAMPLENR
,
0
);
#endif
for
(
uint8_t
h
=
0
;
h
<
HOTENDS
;
++
h
)
{
ECHO_MV
(
" T"
,
h
);
ECHO_MV
(
":"
,
degHotend
(
h
),
1
);
ECHO_MV
(
" T"
,
(
int
)
h
);
ECHO_C
(
':'
);
ECHO_V
(
degHotend
(
h
),
1
);
ECHO_MV
(
"C->"
,
rawHotendTemp
(
h
)
/
OVERSAMPLENR
,
0
);
}
#endif
...
...
@@ -2833,7 +2835,7 @@ void gcode_get_destination() {
if
(
code_seen
(
axis_codes
[
E_AXIS
]))
IDLE_OOZING_retract
(
false
);
#endif
for
(
int
i
=
0
;
i
<
Z_AXIS
;
i
++
)
{
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
if
(
code_seen
(
axis_codes
[
i
]))
destination
[
i
]
=
code_value
()
+
(
axis_relative_modes
[
i
]
||
relative_mode
?
current_position
[
i
]
:
-
hotend_offset
[
i
][
active_extruder
]);
else
...
...
@@ -3988,6 +3990,9 @@ inline void gcode_G28() {
// Sled assembly for Cartesian bots
#if HAS(Z_PROBE_SLED)
dock_sled
(
true
);
// dock the probe
#elif HASNT(SERVO_ENDSTOPS) && Z_RAISE_AFTER_PROBING > 0
// Raise Z axis for non servo based probes
raise_z_after_probing
();
#endif
#if ENABLED(Z_PROBE_END_SCRIPT)
...
...
@@ -4640,6 +4645,15 @@ inline void gcode_M17() {
card
.
mount
();
}
}
#if ENABLED(NEXTION)
/**
* M35: Upload Firmware to Nextion from SD
*/
inline
void
gcode_M35
()
{
UploadNewFirmware
();
}
#endif
#endif
/**
...
...
@@ -7746,6 +7760,10 @@ void process_next_command() {
gcode_M31
();
break
;
case
32
:
// M32 - Make directory
gcode_M32
();
break
;
#if ENABLED(NEXTION)
case
35
:
// M35 - Upload Firmware to Nextion from SD
gcode_M35
();
break
;
#endif
#endif //SDSUPPORT
case
42
:
// M42 -Change pin status via gcode
...
...
@@ -7834,7 +7852,7 @@ void process_next_command() {
gcode_M120
();
break
;
case
121
:
// M121 Disable endstops
gcode_M121
();
break
;
case
122
:
// M12
1
Disable or enable software endstops
case
122
:
// M12
2
Disable or enable software endstops
gcode_M122
();
break
;
#if ENABLED(BARICUDA)
...
...
MK/module/boards/34.h
View file @
8db93807
...
...
@@ -70,6 +70,12 @@
#define ORIG_HEATER_BED_PIN 8 // BED
#define ORIG_TEMP_BED_PIN 14 // ANALOG NUMBERING
#if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL)
#define KILL_PIN 41
#else
#define KILL_PIN -1
#endif
#if NUM_SERVOS > 0
#define SERVO0_PIN 11
#if NUM_SERVOS > 1
...
...
MK/module/boards/35.h
View file @
8db93807
...
...
@@ -70,6 +70,12 @@
#define ORIG_HEATER_BED_PIN -1 // BED
#define ORIG_TEMP_BED_PIN 14 // ANALOG NUMBERING
#if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL)
#define KILL_PIN 41
#else
#define KILL_PIN -1
#endif
#if NUM_SERVOS > 0
#define SERVO0_PIN 11
#if NUM_SERVOS > 1
...
...
MK/module/boards/36.h
View file @
8db93807
...
...
@@ -70,6 +70,12 @@
#define ORIG_HEATER_BED_PIN 8 // BED
#define ORIG_TEMP_BED_PIN 14 // ANALOG NUMBERING
#if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL)
#define KILL_PIN 41
#else
#define KILL_PIN -1
#endif
#if NUM_SERVOS > 0
#define SERVO0_PIN 11
#if NUM_SERVOS > 1
...
...
MK/module/boards/37.h
View file @
8db93807
...
...
@@ -70,6 +70,12 @@
#define ORIG_HEATER_BED_PIN -1 // BED
#define ORIG_TEMP_BED_PIN -1 // ANALOG NUMBERING
#if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) || ENABLED(G3D_PANEL)
#define KILL_PIN 41
#else
#define KILL_PIN -1
#endif
#if NUM_SERVOS > 0
#define SERVO0_PIN 11
#if NUM_SERVOS > 1
...
...
MK/module/conditionals.h
View file @
8db93807
...
...
@@ -373,7 +373,7 @@
#define BACK_PROBE_BED_POSITION DELTA_PROBABLE_RADIUS
// Radius for probe
#define DELTA_PROBABLE_RADIUS
BED_PRINTER
_RADIUS - 5
#define DELTA_PROBABLE_RADIUS
DELTA_PRINTABLE
_RADIUS - 5
#endif
/**
...
...
MK/module/lcd/ultralcd.cpp
View file @
8db93807
...
...
@@ -1011,7 +1011,7 @@ static void _lcd_move(const char* name, AxisEnum axis, int min, int max) {
}
#if MECH(DELTA)
static
float
delta_clip_radius_2
=
BED_PRINTER_RADIUS
*
BED_PRINTER
_RADIUS
;
static
float
delta_clip_radius_2
=
DELTA_PRINTABLE_RADIUS
*
DELTA_PRINTABLE
_RADIUS
;
static
int
delta_clip
(
float
a
)
{
return
sqrt
(
delta_clip_radius_2
-
a
*
a
);
}
static
void
lcd_move_x
()
{
int
clip
=
delta_clip
(
current_position
[
Y_AXIS
]);
_lcd_move
(
PSTR
(
MSG_MOVE_X
),
X_AXIS
,
max
(
X_MIN_POS
,
-
clip
),
min
(
X_MAX_POS
,
clip
));
}
static
void
lcd_move_y
()
{
int
clip
=
delta_clip
(
current_position
[
X_AXIS
]);
_lcd_move
(
PSTR
(
MSG_MOVE_X
),
X_AXIS
,
max
(
X_MIN_POS
,
-
clip
),
min
(
X_MAX_POS
,
clip
));
}
...
...
MK/module/motion/stepper.cpp
View file @
8db93807
...
...
@@ -1458,7 +1458,7 @@ void digipot_init() {
#if MB(ALLIGATOR)
unsigned
int
digipot_motor
=
0
;
for
(
uint8_t
i
=
0
;
i
<
3
+
DRIVER_EXTRUDERS
;
i
++
)
{
digipot_motor
=
255
*
(
motor_current
[
i
]
/
2.5
)
;
digipot_motor
=
255
*
motor_current
[
i
]
/
3.3
;
ExternalDac
::
setValue
(
i
,
digipot_motor
);
}
#endif//MB(ALLIGATOR)
...
...
MK/module/nextion/NexHardware.cpp
View file @
8db93807
...
...
@@ -84,7 +84,6 @@ __return:
return
ret
;
}
/*
* Receive string data.
*
...
...
@@ -222,7 +221,7 @@ bool nexInit(void)
{
bool
ret1
=
false
;
bool
ret2
=
false
;
// Try default baudrate
dbSerialBegin
(
9600
);
nexSerial
.
begin
(
9600
);
...
...
@@ -232,19 +231,20 @@ bool nexInit(void)
sendCommand
(
"page 0"
);
ret2
=
recvRetCommandFinished
();
// If baudrate is 9600 set to
576
00 and reconnect
// If baudrate is 9600 set to
1152
00 and reconnect
if
(
ret1
&&
ret2
)
{
sendCommand
(
"baud=
576
00"
);
sendCommand
(
"baud=
1152
00"
);
nexSerial
.
end
();
HAL
::
delayMilliseconds
(
1000
);
nexSerial
.
begin
(
576
00
);
nexSerial
.
begin
(
1152
00
);
return
ret1
&&
ret2
;
// Else try to 57600 baudrate
}
else
{
// Else try to 115200 baudrate
}
else
{
nexSerial
.
end
();
HAL
::
delayMilliseconds
(
1000
);
nexSerial
.
begin
(
576
00
);
nexSerial
.
begin
(
1152
00
);
sendCommand
(
""
);
sendCommand
(
"bkcmd=1"
);
ret1
=
recvRetCommandFinished
();
...
...
@@ -409,4 +409,4 @@ bool setDefaultBaudrate(uint32_t defaultBaudrate)
void
sendRefreshAll
(
void
)
{
sendCommand
(
"ref 0"
);
}
\ No newline at end of file
}
MK/module/nextion/NexUpload.cpp
0 → 100644
View file @
8db93807
/**
* @file NexUpload.cpp
*
* The implementation of upload tft file for nextion.
*
* @author Chen Zengpeng (email:<zengpeng.chen@itead.cc>)
* @date 2016/3/29
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*/
#include "NexUpload.h"
#if ENABLED(SDSUPPORT)
NexUpload
::
NexUpload
(
const
char
*
file_name
,
uint32_t
upload_baudrate
)
{
_file_name
=
file_name
;
_upload_baudrate
=
upload_baudrate
;
}
NexUpload
::
NexUpload
(
const
String
file_Name
,
uint32_t
upload_baudrate
)
{
NexUpload
(
file_Name
.
c_str
(),
upload_baudrate
);
}
void
NexUpload
::
startUpload
(
void
)
{
if
(
!
_checkFile
())
{
ECHO_LM
(
ER
,
"The file is error"
);
return
;
}
if
(
_getBaudrate
()
==
0
)
{
ECHO_LM
(
ER
,
"baudrate error"
);
return
;
}
if
(
!
_setUploadBaudrate
(
_upload_baudrate
))
{
ECHO_LM
(
ER
,
"modify baudrate error"
);
return
;
}
if
(
!
_uploadTftFile
())
{
ECHO_LM
(
ER
,
"upload file error"
);
return
;
}
card
.
closeFile
();
ECHO_LM
(
DB
,
"upload ok"
);
}
uint16_t
NexUpload
::
_getBaudrate
(
void
)
{
uint32_t
baudrate_array
[
7
]
=
{
115200
,
57600
,
38400
,
19200
,
9600
,
4800
,
2400
};
for
(
uint8_t
i
=
0
;
i
<
7
;
i
++
)
{
if
(
_searchBaudrate
(
baudrate_array
[
i
]))
{
_baudrate
=
baudrate_array
[
i
];
break
;
}
}
return
_baudrate
;
}
bool
NexUpload
::
_checkFile
(
void
)
{
ECHO_LMT
(
DB
,
"Start checkFile "
,
_file_name
);
if
(
!
card
.
selectFile
(
_file_name
))
{
ECHO_LM
(
ER
,
"file is not exit"
);
return
0
;
}
_unuploadByte
=
card
.
fileSize
;
return
1
;
}
bool
NexUpload
::
_searchBaudrate
(
uint32_t
baudrate
)
{
String
string
=
String
(
""
);
nexSerial
.
end
();
HAL
::
delayMilliseconds
(
100
);
nexSerial
.
begin
(
baudrate
);
this
->
sendCommand
(
""
);
this
->
sendCommand
(
"connect"
);
this
->
recvRetString
(
string
);
if
(
string
.
indexOf
(
"comok"
)
!=
-
1
)
return
1
;
return
0
;
}
void
NexUpload
::
sendCommand
(
const
char
*
cmd
)
{
while
(
nexSerial
.
available
())
nexSerial
.
read
();
nexSerial
.
print
(
cmd
);
nexSerial
.
write
(
0xFF
);
nexSerial
.
write
(
0xFF
);
nexSerial
.
write
(
0xFF
);
}
uint16_t
NexUpload
::
recvRetString
(
String
&
string
,
uint32_t
timeout
,
bool
recv_flag
)
{
uint16_t
ret
=
0
;
uint8_t
c
=
0
;
long
start
;
bool
exit_flag
=
false
;
start
=
millis
();
while
(
millis
()
-
start
<=
timeout
)
{
while
(
nexSerial
.
available
())
{
c
=
nexSerial
.
read
();
if
(
c
==
0
)
continue
;
string
+=
(
char
)
c
;
if
(
recv_flag
)
{
if
(
string
.
indexOf
(
0x05
)
!=
-
1
)
exit_flag
=
true
;
}
}
if
(
exit_flag
)
break
;
}
ret
=
string
.
length
();
return
ret
;
}
bool
NexUpload
::
_setUploadBaudrate
(
uint32_t
baudrate
)
{
String
string
=
String
(
""
);
String
cmd
=
String
(
""
);
String
filesize_str
=
String
(
_unuploadByte
,
10
);
String
baudrate_str
=
String
(
baudrate
,
10
);
cmd
=
"whmi-wri "
+
filesize_str
+
","
+
baudrate_str
+
",0"
;
this
->
sendCommand
(
""
);
this
->
sendCommand
(
cmd
.
c_str
());
HAL
::
delayMilliseconds
(
50
);
nexSerial
.
begin
(
baudrate
);
this
->
recvRetString
(
string
,
500
);
if
(
string
.
indexOf
(
0x05
)
!=
-
1
)
return
1
;
return
0
;
}
bool
NexUpload
::
_uploadTftFile
(
void
)
{
uint8_t
c
;
uint16_t
send_timer
=
0
;
uint16_t
last_send_num
=
0
;
String
string
=
String
(
""
);
send_timer
=
_unuploadByte
/
4096
+
1
;
last_send_num
=
_unuploadByte
%
4096
;
while
(
send_timer
)
{
if
(
send_timer
==
1
)
{
for
(
uint16_t
j
=
1
;
j
<=
4096
;
j
++
)
{
if
(
j
<=
last_send_num
)
{
c
=
card
.
get
();
nexSerial
.
write
(
c
);
}
else
break
;
}
}
else
{
for
(
uint16_t
i
=
1
;
i
<=
4096
;
i
++
)
{
c
=
card
.
get
();
nexSerial
.
write
(
c
);
}
}
this
->
recvRetString
(
string
,
500
,
true
);
if
(
string
.
indexOf
(
0x05
)
!=
-
1
)
string
=
""
;
else
return
0
;
--
send_timer
;
}
}
#endif // SDSUPPORT
MK/module/nextion/NexUpload.h
0 → 100644
View file @
8db93807
/**
* @file NexUpload.h
*
* The definition of class NexUpload.
*
* @author Chen Zengpeng (email:<zengpeng.chen@itead.cc>)
* @date 2016/3/29
*
* @copyright
* Copyright (C) 2014-2015 ITEAD Intelligent Systems Co., Ltd. \n
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*/
#ifndef __NEXUPLOAD_H__
#define __NEXUPLOAD_H__
#include "NexHardware.h"
/**
* @addtogroup CoreAPI
* @{
*/
/**
*
* Provides the API for nextion to upload the ftf file.
*/
class
NexUpload
{
public
:
/* methods */
/**
* Constructor.
*
* @param file_name - tft file name.
* @upload_baudrate - set upload baudrate.
*/
NexUpload
(
const
char
*
file_name
,
uint32_t
upload_baudrate
);
/**
* Constructor.
*
* @param file_name - tft file name.
* @param SD_chip_select - sd chip select pin.
* @upload_baudrate - set upload baudrate.
*/
NexUpload
(
const
String
file_Name
,
uint32_t
upload_baudrate
);
/**
* destructor.
*
*/
~
NexUpload
(){}
/*
* start upload.
*
* @return none.
*/
void
startUpload
(
void
);
private
:
/* methods */
/*
* get communicate baudrate.
*
* @return communicate baudrate.
*
*/
uint16_t
_getBaudrate
(
void
);
/*
* check tft file.
*
* @return true if success, false for failure.
*/
bool
_checkFile
(
void
);
/*
* search communicate baudrate.
*
* @param baudrate - communicate baudrate.
*
* @return true if success, false for failure.
*/
bool
_searchBaudrate
(
uint32_t
baudrate
);
/*
* set upload baudrate.
*
* @param baudrate - set upload baudrate.
*
* @return true if success, false for failure.
*/
bool
_setUploadBaudrate
(
uint32_t
baudrate
);
/**
* start dowload tft file to nextion.
*
* @return none.
*/
bool
_uploadTftFile
(
void
);
/*
* Send command to Nextion.
*
* @param cmd - the string of command.
*
* @return none.
*/
void
sendCommand
(
const
char
*
cmd
);
/*
* Receive string data.
*
* @param buffer - save string data.
* @param timeout - set timeout time.
* @param recv_flag - if recv_flag is true,will braak when receive 0x05.
*
* @return the length of string buffer.
*
*/
uint16_t
recvRetString
(
String
&
string
,
uint32_t
timeout
=
100
,
bool
recv_flag
=
false
);
private
:
/* data */
uint32_t
_baudrate
;
/*nextion serail baudrate*/
const
char
*
_file_name
;
/*nextion tft file name*/
uint32_t
_unuploadByte
;
/*unupload byte of tft file*/
uint32_t
_upload_baudrate
;
/*upload baudrate*/
};
#endif
/* #ifndef __NEXDOWNLOAD_H__ */
MK/module/nextion/Nextion.h
View file @
8db93807
...
...
@@ -21,6 +21,7 @@
#include "NexConfig.h"
#include "NexTouch.h"
#include "NexHardware.h"
#include "NexUpload.h"
#include "NexButton.h"
//#include "NexCrop.h"
...
...
MK/module/nextion/Nextion_gfx.h
View file @
8db93807
...
...
@@ -148,7 +148,7 @@
cmd
+=
","
;
cmd
+=
buf2
;
cmd
+=
","
;
cmd
+=
buf3
;
cmd
+=
buf3
;
cmd
+=
","
;
cmd
+=
buf4
;
sendCommand
(
cmd
.
c_str
());
...
...
MK/module/nextion/Nextion_lcd.cpp
View file @
8db93807
...
...
@@ -16,6 +16,7 @@
#if ENABLED(SDSUPPORT)
uint8_t
SDstatus
=
0
;
// 0 SD not insert, 1 SD insert, 2 SD printing
NexUpload
Firmware
(
NEXTION_FIRMWARE_FILE
,
57600
);
#endif
#if ENABLED(NEXTION_GFX)
...
...
@@ -34,7 +35,7 @@
NexPage
Pgcode
=
NexPage
(
8
,
0
,
"gcode"
);
// Page 0 Start
NexTimer
startimer
=
NexTimer
(
0
,
1
,
"tm0"
);
NexTimer
startimer
=
NexTimer
(
0
,
1
,
"tm0"
);
// Page 1 Info
NexText
Hotend0
=
NexText
(
1
,
2
,
"t0"
);
...
...
@@ -43,9 +44,7 @@
NexText
Hotend2
=
NexText
(
1
,
6
,
"t2"
);
NexText
LedStatus
=
NexText
(
1
,
7
,
"status"
);
NexText
LedCoord1
=
NexText
(
1
,
8
,
"icoord"
);
NexPicture
Menu
=
NexPicture
(
1
,
9
,
"p0"
);
NexPicture
MSD1
=
NexPicture
(
1
,
10
,
"p1"
);
NexPicture
MSetup
=
NexPicture
(
1
,
11
,
"p2"
);
NexPicture
Hend0
=
NexPicture
(
1
,
12
,
"p3"
);
NexHotspot
hot0
=
NexHotspot
(
1
,
13
,
"hot0"
);
NexPicture
Hend1
=
NexPicture
(
1
,
14
,
"p4"
);
...
...
@@ -123,12 +122,10 @@
NexTouch
*
nex_listen_list
[]
=
{
&
Pstart
,
&
Menu
,
&
MSD1
,
&
MSD3
,
&
MSD5
,
&
MSD6
,
&
MSetup
,
&
Fanpic
,
&
Speedpic
,
&
NPlay
,
...
...
@@ -222,7 +219,6 @@
}
Pinfo
.
show
();
NextionPage
=
1
;
#if ENABLED(NEXTION_GFX)
#if MECH(DELTA)
...
...
@@ -291,7 +287,6 @@
}
void
setpageSDPopCallback
(
void
*
ptr
)
{
NextionPage
=
4
;
Psdcard
.
show
();
uint16_t
fileCnt
=
card
.
getnrfilenames
();
...
...
@@ -360,6 +355,14 @@
card
.
updir
();
setpageSDPopCallback
(
&
MSD1
);
}
void
UploadNewFirmware
()
{
if
(
IS_SD_INSERTED
||
card
.
cardOK
)
{
Firmware
.
startUpload
();
nexSerial
.
end
();
lcd_init
();
}
}
#endif
void
ExitPopCallback
(
void
*
ptr
)
{
...
...
@@ -372,7 +375,6 @@
void
hotPopCallback
(
void
*
ptr
)
{
Ptemp
.
show
();
NextionPage
=
2
;
memset
(
buffer
,
0
,
sizeof
(
buffer
));
if
(
ptr
==
&
hot0
)
{
if
(
degTargetHotend
(
0
)
!=
0
)
{
...
...
@@ -437,33 +439,23 @@
Pmenu
.
show
();
}
void
setpagePopCallback
(
void
*
ptr
)
{
if
(
ptr
==
&
Menu
)
{
NextionPage
=
3
;
Pmenu
.
show
();
}
else
if
(
ptr
==
&
MSetup
)
{
NextionPage
=
5
;
Psetup
.
show
();
void
setfanPopCallback
(
void
*
ptr
)
{
if
(
fanSpeed
)
{
fanSpeed
=
0
;
fantimer
.
disable
();
}
else
if
(
ptr
==
&
Speedpic
)
{
NextionPage
=
7
;
Pspeed
.
show
();
else
{
fanSpeed
=
255
;
fantimer
.
enable
();
}
}
void
setfanPopCallback
(
void
*
ptr
)
{
if
(
fanSpeed
)
fanSpeed
=
0
;
else
fanSpeed
=
255
;
}
void
setmovePopCallback
(
void
*
ptr
)
{
memset
(
buffer
,
0
,
sizeof
(
buffer
));
movecmd
.
getText
(
buffer
,
sizeof
(
buffer
));
enqueuecommands_P
(
PSTR
(
"G91"
));
enqueuecommands_P
(
buffer
);
enqueuecommands_P
(
PSTR
(
"G90"
));
NextionPage
=
6
;
}
#if ENABLED(SDSUPPORT)
...
...
@@ -534,9 +526,6 @@
hot2
.
attachPop
(
hotPopCallback
,
&
hot2
);
#endif
Menu
.
attachPop
(
setpagePopCallback
,
&
Menu
);
MSetup
.
attachPop
(
setpagePopCallback
,
&
MSetup
);
Speedpic
.
attachPop
(
setpagePopCallback
,
&
Speedpic
);
Fanpic
.
attachPop
(
setfanPopCallback
,
&
Fanpic
);
m11
.
attachPop
(
sethotPopCallback
,
&
m11
);
tup
.
attachPop
(
settempPopCallback
,
&
tup
);
...
...
@@ -619,8 +608,10 @@
millis_t
ms
=
millis
();
if
(
ms
>
next_lcd_update_ms
)
{
if
(
NextionPage
==
1
)
{
sendCurrentPageId
(
&
NextionPage
);
if
(
NextionPage
==
1
)
{
if
(
fanSpeed
>
0
)
fantimer
.
enable
();
else
fantimer
.
disable
();
...
...
MK/module/nextion/Nextion_lcd.h
View file @
8db93807
...
...
@@ -3,9 +3,9 @@
#if ENABLED(NEXTION)
#define LCD_UPDATE_INTERVAL 4000
#define NEXTION_FIRMWARE_FILE "marlinkimbra.tft"
void
ExitPopCallback
(
void
*
ptr
);
void
setpagePopCallback
(
void
*
ptr
);
void
hotPopCallback
(
void
*
ptr
);
void
sethotPopCallback
(
void
*
ptr
);
void
settempPopCallback
(
void
*
ptr
);
...
...
@@ -33,6 +33,7 @@
void
sdfolderUpPopCallback
(
void
*
ptr
);
void
PlayPausePopCallback
(
void
*
ptr
);
void
StopPopCallback
(
void
*
ptr
);
void
UploadNewFirmware
();
#endif
FORCE_INLINE
bool
lcd_hasstatus
()
{
return
false
;
}
...
...
MK/module/sanitycheck.h
View file @
8db93807
...
...
@@ -1235,8 +1235,8 @@
#endif
#if MECH(DELTA)
#if DISABLED(DE
FAULT_DE
LTA_DIAGONAL_ROD)
#error DEPENDENCY ERROR: Missing setting DE
FAULT_DE
LTA_DIAGONAL_ROD
#if DISABLED(DELTA_DIAGONAL_ROD)
#error DEPENDENCY ERROR: Missing setting DELTA_DIAGONAL_ROD
#endif
#if DISABLED(DELTA_SMOOTH_ROD_OFFSET)
#error DEPENDENCY ERROR: Missing setting DELTA_SMOOTH_ROD_OFFSET
...
...
@@ -1244,8 +1244,8 @@
#if DISABLED(DELTA_CARRIAGE_OFFSET)
#error DEPENDENCY ERROR: Missing setting DELTA_CARRIAGE_OFFSET
#endif
#if DISABLED(
BED_PRINTER
_RADIUS)
#error DEPENDENCY ERROR: Missing setting
BED_PRINTER
_RADIUS
#if DISABLED(
DELTA_PRINTABLE
_RADIUS)
#error DEPENDENCY ERROR: Missing setting
DELTA_PRINTABLE
_RADIUS
#endif
#if DISABLED(DEFAULT_DELTA_RADIUS)
#error DEPENDENCY ERROR: Missing setting DEFAULT_DELTA_RADIUS
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment