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
b5ad3ab5
Commit
b5ad3ab5
authored
Apr 18, 2016
by
MagoKimbra
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'refs/remotes/origin/master' into dev
parents
033ec4d4
9efab768
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
382 additions
and
40 deletions
+382
-40
GCodes.md
Documentation/GCodes.md
+1
-0
changelog.md
Documentation/changelog.md
+1
-0
MK.ino
MK/MK.ino
+1
-0
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
+14
-1
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
NexDownload.cpp
MK/module/nextion/NexDownload.cpp
+175
-0
NexDownload.h
MK/module/nextion/NexDownload.h
+135
-0
NexHardware.cpp
MK/module/nextion/NexHardware.cpp
+7
-8
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
No files found.
Documentation/GCodes.md
View file @
b5ad3ab5
...
...
@@ -43,6 +43,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 - Download Firmware 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 @
b5ad3ab5
### 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 download firmware nextion from SD
*
Rewrite macros
*
Fix M109 so it won't wait for cooling
*
Clear code
...
...
MK/MK.ino
View file @
b5ad3ab5
...
...
@@ -79,6 +79,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 - Download Firmware 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 @
b5ad3ab5
No preview for this file type
MK/Nextion FW/marlinkimbra_v0_7_
0
.tft
→
MK/Nextion FW/marlinkimbra_v0_7_
2
.tft
View file @
b5ad3ab5
No preview for this file type
MK/module/MK_Main.cpp
View file @
b5ad3ab5
...
...
@@ -4424,6 +4424,15 @@ inline void gcode_M17() {
card
.
mount
();
}
}
#if ENABLED(NEXTION)
/**
* M35: Download Firmware Nextion
*/
inline
void
gcode_M35
()
{
DownloadNewFirmware
();
}
#endif
#endif
/**
...
...
@@ -7438,6 +7447,10 @@ void process_next_command() {
gcode_M31
();
break
;
case
32
:
// M32 - Make directory
gcode_M32
();
break
;
#if ENABLED(NEXTION)
case
35
:
// M35 - Download Firmware Nextion
gcode_M35
();
break
;
#endif
#endif //SDSUPPORT
case
42
:
// M42 -Change pin status via gcode
...
...
@@ -7526,7 +7539,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 @
b5ad3ab5
...
...
@@ -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 @
b5ad3ab5
...
...
@@ -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 @
b5ad3ab5
...
...
@@ -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 @
b5ad3ab5
...
...
@@ -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/nextion/NexDownload.cpp
0 → 100644
View file @
b5ad3ab5
/**
* @file NexDownload.cpp
*
* The implementation of download 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 "NexDownload.h"
#if ENABLED(SDSUPPORT)
NexDownload
::
NexDownload
(
const
char
*
file_name
,
uint32_t
download_baudrate
)
{
_file_name
=
file_name
;
_download_baudrate
=
download_baudrate
;
}
NexDownload
::
NexDownload
(
const
String
file_Name
,
uint32_t
download_baudrate
)
{
NexDownload
(
file_Name
.
c_str
(),
download_baudrate
);
}
void
NexDownload
::
startDownload
(
void
)
{
if
(
!
_checkFile
())
{
ECHO_LM
(
ER
,
"The file is error"
);
return
;
}
if
(
_getBaudrate
()
==
0
)
{
ECHO_LM
(
ER
,
"baudrate error"
);
return
;
}
if
(
!
_setDownloadBaudrate
(
_download_baudrate
))
{
ECHO_LM
(
ER
,
"modify baudrate error"
);
return
;
}
if
(
!
_downloadTftFile
())
{
ECHO_LM
(
ER
,
"download file error"
);
return
;
}
card
.
closeFile
();
ECHO_LM
(
DB
,
"download ok"
);
}
uint16_t
NexDownload
::
_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
NexDownload
::
_checkFile
(
void
)
{
ECHO_LM
(
DB
,
"start _checkFile"
);
if
(
!
card
.
selectFile
(
_file_name
))
{
ECHO_LM
(
ER
,
"file is not exit"
);
return
0
;
}
_undownloadByte
=
card
.
fileSize
;
return
1
;
}
bool
NexDownload
::
_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
NexDownload
::
sendCommand
(
const
char
*
cmd
)
{
while
(
nexSerial
.
available
())
nexSerial
.
read
();
nexSerial
.
print
(
cmd
);
nexSerial
.
write
(
0xFF
);
nexSerial
.
write
(
0xFF
);
nexSerial
.
write
(
0xFF
);
}
uint16_t
NexDownload
::
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
NexDownload
::
_setDownloadBaudrate
(
uint32_t
baudrate
)
{
String
string
=
String
(
""
);
String
cmd
=
String
(
""
);
String
filesize_str
=
String
(
_undownloadByte
,
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
NexDownload
::
_downloadTftFile
(
void
)
{
uint8_t
c
;
uint16_t
send_timer
=
0
;
uint16_t
last_send_num
=
0
;
String
string
=
String
(
""
);
send_timer
=
_undownloadByte
/
4096
+
1
;
last_send_num
=
_undownloadByte
%
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/NexDownload.h
0 → 100644
View file @
b5ad3ab5
/**
* @file NexDownload.h
*
* The definition of class NexDownload.
*
* @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 __NEXDOWNLOAD_H__
#define __NEXDOWNLOAD_H__
#include "NexHardware.h"
/**
* @addtogroup CoreAPI
* @{
*/
/**
*
* Provides the API for nextion to download the ftf file.
*/
class
NexDownload
{
public
:
/* methods */
/**
* Constructor.
*
* @param file_name - tft file name.
* @download_baudrate - set download baudrate.
*/
NexDownload
(
const
char
*
file_name
,
uint32_t
download_baudrate
);
/**
* Constructor.
*
* @param file_name - tft file name.
* @param SD_chip_select - sd chip select pin.
* @download_baudrate - set download baudrate.
*/
NexDownload
(
const
String
file_Name
,
uint32_t
download_baudrate
);
/**
* destructor.
*
*/
~
NexDownload
(){}
/*
* start download.
*
* @return none.
*/
void
startDownload
();
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 download baudrate.
*
* @param baudrate - set download baudrate.
*
* @return true if success, false for failure.
*/
bool
_setDownloadBaudrate
(
uint32_t
baudrate
);
/**
* start dowload tft file to nextion.
*
* @return none.
*/
bool
_downloadTftFile
(
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
_undownloadByte
;
/*undownload byte of tft file*/
uint32_t
_download_baudrate
;
/*download baudrate*/
};
#endif
/* #ifndef __NEXDOWNLOAD_H__ */
MK/module/nextion/NexHardware.cpp
View file @
b5ad3ab5
...
...
@@ -84,7 +84,6 @@ __return:
return
ret
;
}
/*
* Receive string data.
*
...
...
@@ -232,19 +231,19 @@ 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
576
00 baudrate
// Else try to
1152
00 baudrate
}
else
{
nexSerial
.
end
();
HAL
::
delayMilliseconds
(
1000
);
nexSerial
.
begin
(
576
00
);
nexSerial
.
begin
(
1152
00
);
sendCommand
(
""
);
sendCommand
(
"bkcmd=1"
);
ret1
=
recvRetCommandFinished
();
...
...
MK/module/nextion/Nextion.h
View file @
b5ad3ab5
...
...
@@ -21,6 +21,7 @@
#include "NexConfig.h"
#include "NexTouch.h"
#include "NexHardware.h"
#include "NexDownload.h"
#include "NexButton.h"
//#include "NexCrop.h"
...
...
MK/module/nextion/Nextion_gfx.h
View file @
b5ad3ab5
...
...
@@ -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 @
b5ad3ab5
...
...
@@ -16,6 +16,7 @@
#if ENABLED(SDSUPPORT)
uint8_t
SDstatus
=
0
;
// 0 SD not insert, 1 SD insert, 2 SD printing
NexDownload
Firmware
(
NEXTION_FIRMWARE_FILE
,
57600
);
#endif
#if ENABLED(NEXTION_GFX)
...
...
@@ -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
DownloadNewFirmware
()
{
if
(
IS_SD_INSERTED
||
card
.
cardOK
)
{
Firmware
.
startDownload
();
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,24 +439,15 @@
Pmenu
.
show
();
}
void
setpagePopCallback
(
void
*
ptr
)
{
if
(
ptr
==
&
Menu
)
{
NextionPage
=
3
;
Pmenu
.
show
();
}
else
if
(
ptr
==
&
MSetup
)
{
NextionPage
=
5
;
Psetup
.
show
();
}
else
if
(
ptr
==
&
Speedpic
)
{
NextionPage
=
7
;
Pspeed
.
show
();
void
setfanPopCallback
(
void
*
ptr
)
{
if
(
fanSpeed
)
{
fanSpeed
=
0
;
fantimer
.
disable
();
}
else
{
fanSpeed
=
255
;
fantimer
.
enable
();
}
void
setfanPopCallback
(
void
*
ptr
)
{
if
(
fanSpeed
)
fanSpeed
=
0
;
else
fanSpeed
=
255
;
}
void
setmovePopCallback
(
void
*
ptr
)
{
...
...
@@ -463,7 +456,6 @@
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 @
b5ad3ab5
...
...
@@ -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
DownloadNewFirmware
();
#endif
FORCE_INLINE
bool
lcd_hasstatus
()
{
return
false
;
}
...
...
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