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
bda01841
Commit
bda01841
authored
Apr 21, 2016
by
MagoKimbra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Upload to Nextion
parent
9efab768
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
57 additions
and
56 deletions
+57
-56
GCodes.md
Documentation/GCodes.md
+1
-1
changelog.md
Documentation/changelog.md
+1
-1
MK.ino
MK/MK.ino
+1
-1
MK_Main.cpp
MK/module/MK_Main.cpp
+4
-4
NexHardware.cpp
MK/module/nextion/NexHardware.cpp
+2
-1
NexUpload.cpp
MK/module/nextion/NexUpload.cpp
+24
-24
NexUpload.h
MK/module/nextion/NexUpload.h
+19
-19
Nextion.h
MK/module/nextion/Nextion.h
+1
-1
Nextion_lcd.cpp
MK/module/nextion/Nextion_lcd.cpp
+3
-3
Nextion_lcd.h
MK/module/nextion/Nextion_lcd.h
+1
-1
No files found.
Documentation/GCodes.md
View file @
bda01841
...
...
@@ -43,7 +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
*
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 @
bda01841
### 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 n
extion from SD
*
Add M35 for
upload firmware to N
extion from SD
*
Rewrite macros
*
Fix M109 so it won't wait for cooling
*
Clear code
...
...
MK/MK.ino
View file @
bda01841
...
...
@@ -79,7 +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
* 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/module/MK_Main.cpp
View file @
bda01841
...
...
@@ -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
...
...
@@ -4427,10 +4427,10 @@ inline void gcode_M17() {
#if ENABLED(NEXTION)
/**
* M35:
Download Firmware Nextion
* M35:
Upload Firmware to Nextion from SD
*/
inline
void
gcode_M35
()
{
Down
loadNewFirmware
();
Up
loadNewFirmware
();
}
#endif
#endif
...
...
@@ -7448,7 +7448,7 @@ void process_next_command() {
case
32
:
// M32 - Make directory
gcode_M32
();
break
;
#if ENABLED(NEXTION)
case
35
:
// M35 -
Download Firmware Nextion
case
35
:
// M35 -
Upload Firmware to Nextion from SD
gcode_M35
();
break
;
#endif
#endif //SDSUPPORT
...
...
MK/module/nextion/NexHardware.cpp
View file @
bda01841
...
...
@@ -240,7 +240,8 @@ bool nexInit(void)
return
ret1
&&
ret2
;
// Else try to 115200 baudrate
}
else
{
}
else
{
nexSerial
.
end
();
HAL
::
delayMilliseconds
(
1000
);
nexSerial
.
begin
(
115200
);
...
...
MK/module/nextion/Nex
Down
load.cpp
→
MK/module/nextion/Nex
Up
load.cpp
View file @
bda01841
/**
* @file Nex
Down
load.cpp
* @file Nex
Up
load.cpp
*
* The implementation of
down
load tft file for nextion.
* The implementation of
up
load tft file for nextion.
*
* @author Chen Zengpeng (email:<zengpeng.chen@itead.cc>)
* @date 2016/3/29
...
...
@@ -13,20 +13,20 @@
* the License, or (at your option) any later version.
*/
#include "Nex
Down
load.h"
#include "Nex
Up
load.h"
#if ENABLED(SDSUPPORT)
Nex
Download
::
NexDownload
(
const
char
*
file_name
,
uint32_t
down
load_baudrate
)
{
Nex
Upload
::
NexUpload
(
const
char
*
file_name
,
uint32_t
up
load_baudrate
)
{
_file_name
=
file_name
;
_
download_baudrate
=
down
load_baudrate
;
_
upload_baudrate
=
up
load_baudrate
;
}
Nex
Download
::
NexDownload
(
const
String
file_Name
,
uint32_t
down
load_baudrate
)
{
Nex
Download
(
file_Name
.
c_str
(),
down
load_baudrate
);
Nex
Upload
::
NexUpload
(
const
String
file_Name
,
uint32_t
up
load_baudrate
)
{
Nex
Upload
(
file_Name
.
c_str
(),
up
load_baudrate
);
}
void
Nex
Download
::
startDown
load
(
void
)
{
void
Nex
Upload
::
startUp
load
(
void
)
{
if
(
!
_checkFile
())
{
ECHO_LM
(
ER
,
"The file is error"
);
return
;
...
...
@@ -35,19 +35,19 @@
ECHO_LM
(
ER
,
"baudrate error"
);
return
;
}
if
(
!
_set
DownloadBaudrate
(
_down
load_baudrate
))
{
if
(
!
_set
UploadBaudrate
(
_up
load_baudrate
))
{
ECHO_LM
(
ER
,
"modify baudrate error"
);
return
;
}
if
(
!
_
down
loadTftFile
())
{
ECHO_LM
(
ER
,
"
down
load file error"
);
if
(
!
_
up
loadTftFile
())
{
ECHO_LM
(
ER
,
"
up
load file error"
);
return
;
}
card
.
closeFile
();
ECHO_LM
(
DB
,
"
down
load ok"
);
ECHO_LM
(
DB
,
"
up
load ok"
);
}
uint16_t
Nex
Down
load
::
_getBaudrate
(
void
)
{
uint16_t
Nex
Up
load
::
_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
]))
{
...
...
@@ -58,17 +58,17 @@
return
_baudrate
;
}
bool
Nex
Down
load
::
_checkFile
(
void
)
{
ECHO_LM
(
DB
,
"start _checkFile"
);
bool
Nex
Up
load
::
_checkFile
(
void
)
{
ECHO_LM
T
(
DB
,
"Start checkFile "
,
_file_name
);
if
(
!
card
.
selectFile
(
_file_name
))
{
ECHO_LM
(
ER
,
"file is not exit"
);
return
0
;
}
_un
down
loadByte
=
card
.
fileSize
;
_un
up
loadByte
=
card
.
fileSize
;
return
1
;
}
bool
Nex
Down
load
::
_searchBaudrate
(
uint32_t
baudrate
)
{
bool
Nex
Up
load
::
_searchBaudrate
(
uint32_t
baudrate
)
{
String
string
=
String
(
""
);
nexSerial
.
end
();
HAL
::
delayMilliseconds
(
100
);
...
...
@@ -83,7 +83,7 @@
return
0
;
}
void
Nex
Down
load
::
sendCommand
(
const
char
*
cmd
)
{
void
Nex
Up
load
::
sendCommand
(
const
char
*
cmd
)
{
while
(
nexSerial
.
available
())
nexSerial
.
read
();
...
...
@@ -93,7 +93,7 @@
nexSerial
.
write
(
0xFF
);
}
uint16_t
Nex
Down
load
::
recvRetString
(
String
&
string
,
uint32_t
timeout
,
bool
recv_flag
)
{
uint16_t
Nex
Up
load
::
recvRetString
(
String
&
string
,
uint32_t
timeout
,
bool
recv_flag
)
{
uint16_t
ret
=
0
;
uint8_t
c
=
0
;
long
start
;
...
...
@@ -117,11 +117,11 @@
return
ret
;
}
bool
Nex
Download
::
_setDown
loadBaudrate
(
uint32_t
baudrate
)
{
bool
Nex
Upload
::
_setUp
loadBaudrate
(
uint32_t
baudrate
)
{
String
string
=
String
(
""
);
String
cmd
=
String
(
""
);
String
filesize_str
=
String
(
_un
down
loadByte
,
10
);
String
filesize_str
=
String
(
_un
up
loadByte
,
10
);
String
baudrate_str
=
String
(
baudrate
,
10
);
cmd
=
"whmi-wri "
+
filesize_str
+
","
+
baudrate_str
+
",0"
;
...
...
@@ -136,13 +136,13 @@
return
0
;
}
bool
Nex
Download
::
_down
loadTftFile
(
void
)
{
bool
Nex
Upload
::
_up
loadTftFile
(
void
)
{
uint8_t
c
;
uint16_t
send_timer
=
0
;
uint16_t
last_send_num
=
0
;
String
string
=
String
(
""
);
send_timer
=
_un
down
loadByte
/
4096
+
1
;
last_send_num
=
_un
down
loadByte
%
4096
;
send_timer
=
_un
up
loadByte
/
4096
+
1
;
last_send_num
=
_un
up
loadByte
%
4096
;
while
(
send_timer
)
{
if
(
send_timer
==
1
)
{
...
...
MK/module/nextion/Nex
Down
load.h
→
MK/module/nextion/Nex
Up
load.h
View file @
bda01841
/**
* @file Nex
Down
load.h
* @file Nex
Up
load.h
*
* The definition of class Nex
Down
load.
* The definition of class Nex
Up
load.
*
* @author Chen Zengpeng (email:<zengpeng.chen@itead.cc>)
* @date 2016/3/29
...
...
@@ -14,8 +14,8 @@
* the License, or (at your option) any later version.
*/
#ifndef __NEX
DOWN
LOAD_H__
#define __NEX
DOWN
LOAD_H__
#ifndef __NEX
UP
LOAD_H__
#define __NEX
UP
LOAD_H__
#include "NexHardware.h"
...
...
@@ -26,9 +26,9 @@
/**
*
* Provides the API for nextion to
down
load the ftf file.
* Provides the API for nextion to
up
load the ftf file.
*/
class
Nex
Down
load
class
Nex
Up
load
{
public
:
/* methods */
...
...
@@ -36,31 +36,31 @@
* Constructor.
*
* @param file_name - tft file name.
* @
download_baudrate - set down
load baudrate.
* @
upload_baudrate - set up
load baudrate.
*/
Nex
Download
(
const
char
*
file_name
,
uint32_t
down
load_baudrate
);
Nex
Upload
(
const
char
*
file_name
,
uint32_t
up
load_baudrate
);
/**
* Constructor.
*
* @param file_name - tft file name.
* @param SD_chip_select - sd chip select pin.
* @
download_baudrate - set down
load baudrate.
* @
upload_baudrate - set up
load baudrate.
*/
Nex
Download
(
const
String
file_Name
,
uint32_t
down
load_baudrate
);
Nex
Upload
(
const
String
file_Name
,
uint32_t
up
load_baudrate
);
/**
* destructor.
*
*/
~
Nex
Down
load
(){}
~
Nex
Up
load
(){}
/*
* start
down
load.
* start
up
load.
*
* @return none.
*/
void
start
Download
(
);
void
start
Upload
(
void
);
private
:
/* methods */
...
...
@@ -89,20 +89,20 @@
bool
_searchBaudrate
(
uint32_t
baudrate
);
/*
* set
down
load baudrate.
* set
up
load baudrate.
*
* @param baudrate - set
down
load baudrate.
* @param baudrate - set
up
load baudrate.
*
* @return true if success, false for failure.
*/
bool
_set
Down
loadBaudrate
(
uint32_t
baudrate
);
bool
_set
Up
loadBaudrate
(
uint32_t
baudrate
);
/**
* start dowload tft file to nextion.
*
* @return none.
*/
bool
_
down
loadTftFile
(
void
);
bool
_
up
loadTftFile
(
void
);
/*
* Send command to Nextion.
...
...
@@ -128,8 +128,8 @@
private
:
/* data */
uint32_t
_baudrate
;
/*nextion serail baudrate*/
const
char
*
_file_name
;
/*nextion tft file name*/
uint32_t
_un
downloadByte
;
/*undown
load byte of tft file*/
uint32_t
_
download_baudrate
;
/*down
load baudrate*/
uint32_t
_un
uploadByte
;
/*unup
load byte of tft file*/
uint32_t
_
upload_baudrate
;
/*up
load baudrate*/
};
#endif
/* #ifndef __NEXDOWNLOAD_H__ */
MK/module/nextion/Nextion.h
View file @
bda01841
...
...
@@ -21,7 +21,7 @@
#include "NexConfig.h"
#include "NexTouch.h"
#include "NexHardware.h"
#include "Nex
Down
load.h"
#include "Nex
Up
load.h"
#include "NexButton.h"
//#include "NexCrop.h"
...
...
MK/module/nextion/Nextion_lcd.cpp
View file @
bda01841
...
...
@@ -16,7 +16,7 @@
#if ENABLED(SDSUPPORT)
uint8_t
SDstatus
=
0
;
// 0 SD not insert, 1 SD insert, 2 SD printing
Nex
Down
load
Firmware
(
NEXTION_FIRMWARE_FILE
,
57600
);
Nex
Up
load
Firmware
(
NEXTION_FIRMWARE_FILE
,
57600
);
#endif
#if ENABLED(NEXTION_GFX)
...
...
@@ -356,9 +356,9 @@
setpageSDPopCallback
(
&
MSD1
);
}
void
Down
loadNewFirmware
()
{
void
Up
loadNewFirmware
()
{
if
(
IS_SD_INSERTED
||
card
.
cardOK
)
{
Firmware
.
start
Down
load
();
Firmware
.
start
Up
load
();
nexSerial
.
end
();
lcd_init
();
}
...
...
MK/module/nextion/Nextion_lcd.h
View file @
bda01841
...
...
@@ -33,7 +33,7 @@
void
sdfolderUpPopCallback
(
void
*
ptr
);
void
PlayPausePopCallback
(
void
*
ptr
);
void
StopPopCallback
(
void
*
ptr
);
void
Down
loadNewFirmware
();
void
Up
loadNewFirmware
();
#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