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
c9fc2819
Commit
c9fc2819
authored
Sep 03, 2015
by
MagoKimbra
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Same fix
parent
050b3c40
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
333 additions
and
37 deletions
+333
-37
Marlin_main.cpp
MarlinKimbra/Marlin_main.cpp
+1
-1
comunication.h
MarlinKimbra/comunication.h
+9
-9
conditionals.h
MarlinKimbra/conditionals.h
+1
-1
ultralcd.cpp
MarlinKimbra/ultralcd.cpp
+320
-25
ultralcd.h
MarlinKimbra/ultralcd.h
+2
-1
No files found.
MarlinKimbra/Marlin_main.cpp
View file @
c9fc2819
...
...
@@ -68,7 +68,7 @@
#endif
#if HAS(DIGIPOTSS)
#include
"SPI.h"
#include
<SPI.h>
#endif
...
...
MarlinKimbra/comunication.h
View file @
c9fc2819
...
...
@@ -32,15 +32,15 @@
#endif
#endif
#define START "start" //start for host
#define OK "ok " //ok answer for host
#define ER "
Error: " //
error for host
#define WT "wait" //wait for host
#define DB "echo: " //message for user
#define RS "Resend: " //resend for host
#define PAUSE "//action:pause" //command for host that support action
#define RESUME "//action:resume" //command for host that support action
#define DISCONNECT "//action:disconnect" //command for host that support action
#define START "start" //
start for host
#define OK "ok " //
ok answer for host
#define ER "
error: " //
error for host
#define WT "wait" //
wait for host
#define DB "echo: " //
message for user
#define RS "Resend: " //
resend for host
#define PAUSE "//action:pause" //
command for host that support action
#define RESUME "//action:resume" //
command for host that support action
#define DISCONNECT "//action:disconnect" //
command for host that support action
#define SERIAL_INIT(baud) MYSERIAL.begin(baud), delay(1)
#define SERIAL_WRITE(x) MYSERIAL.write(x)
...
...
MarlinKimbra/conditionals.h
View file @
c9fc2819
...
...
@@ -629,7 +629,7 @@
#define HAS_POWER_SWITCH (POWER_SUPPLY > 0 && PIN_EXISTS(PS_ON))
#define HAS_MOTOR_CURRENT_PWM_XY (PIN_EXISTS(MOTOR_CURRENT_PWM_XY))
#define HAS_DIGIPOTSS (
DIGIPOTSS_PIN >= 0
)
#define HAS_DIGIPOTSS (
PIN_EXISTS(DIGIPOTSS)
)
/**
* Shorthand for filament sensor and power sensor for ultralcd.cpp, dogm_lcd_implementation.h, ultralcd_implementation_hitachi_HD44780.h
...
...
MarlinKimbra/ultralcd.cpp
View file @
c9fc2819
...
...
@@ -2024,7 +2024,284 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#endif // ULTIPANEL
#if !MECH(DELTA) && DISABLED(Z_SAFE_HOMING) && Z_HOME_DIR < 0
/*********************************/
/** Number to string conversion **/
/*********************************/
char
conv
[
8
];
// Convert float to string with +123.4 format
char
*
ftostr3
(
const
float
&
x
)
{
return
itostr3
((
int
)
x
);
}
// Convert int to string with 12 format
char
*
itostr2
(
const
uint8_t
&
x
)
{
//sprintf(conv,"%5.1f",x);
int
xx
=
x
;
conv
[
0
]
=
(
xx
/
10
)
%
10
+
'0'
;
conv
[
1
]
=
xx
%
10
+
'0'
;
conv
[
2
]
=
0
;
return
conv
;
}
// Convert float to string with +123.4 format
char
*
ftostr31
(
const
float
&
x
)
{
int
xx
=
abs
(
x
*
10
);
conv
[
0
]
=
(
x
>=
0
)
?
'+'
:
'-'
;
conv
[
1
]
=
(
xx
/
1000
)
%
10
+
'0'
;
conv
[
2
]
=
(
xx
/
100
)
%
10
+
'0'
;
conv
[
3
]
=
(
xx
/
10
)
%
10
+
'0'
;
conv
[
4
]
=
'.'
;
conv
[
5
]
=
xx
%
10
+
'0'
;
conv
[
6
]
=
0
;
return
conv
;
}
// Convert float to string with 123.4 format, dropping sign
char
*
ftostr31ns
(
const
float
&
x
)
{
int
xx
=
abs
(
x
*
10
);
conv
[
0
]
=
(
xx
/
1000
)
%
10
+
'0'
;
conv
[
1
]
=
(
xx
/
100
)
%
10
+
'0'
;
conv
[
2
]
=
(
xx
/
10
)
%
10
+
'0'
;
conv
[
3
]
=
'.'
;
conv
[
4
]
=
xx
%
10
+
'0'
;
conv
[
5
]
=
0
;
return
conv
;
}
// Convert float to string with 123.4 format
char
*
ftostr32
(
const
float
&
x
)
{
long
xx
=
abs
(
x
*
100
);
conv
[
0
]
=
x
>=
0
?
(
xx
/
10000
)
%
10
+
'0'
:
'-'
;
conv
[
1
]
=
(
xx
/
1000
)
%
10
+
'0'
;
conv
[
2
]
=
(
xx
/
100
)
%
10
+
'0'
;
conv
[
3
]
=
'.'
;
conv
[
4
]
=
(
xx
/
10
)
%
10
+
'0'
;
conv
[
5
]
=
xx
%
10
+
'0'
;
conv
[
6
]
=
0
;
return
conv
;
}
// Convert float to string with 1.234 format
char
*
ftostr43
(
const
float
&
x
)
{
long
xx
=
x
*
1000
;
if
(
xx
>=
0
)
{
conv
[
0
]
=
(
xx
/
1000
)
%
10
+
'0'
;
}
else
{
conv
[
0
]
=
'-'
;
}
xx
=
abs
(
xx
);
conv
[
1
]
=
'.'
;
conv
[
2
]
=
(
xx
/
100
)
%
10
+
'0'
;
conv
[
3
]
=
(
xx
/
10
)
%
10
+
'0'
;
conv
[
4
]
=
(
xx
)
%
10
+
'0'
;
conv
[
5
]
=
0
;
return
conv
;
}
// Convert float to string with 1.23 format
char
*
ftostr12ns
(
const
float
&
x
)
{
long
xx
=
x
*
100
;
xx
=
abs
(
xx
);
conv
[
0
]
=
(
xx
/
100
)
%
10
+
'0'
;
conv
[
1
]
=
'.'
;
conv
[
2
]
=
(
xx
/
10
)
%
10
+
'0'
;
conv
[
3
]
=
(
xx
)
%
10
+
'0'
;
conv
[
4
]
=
0
;
return
conv
;
}
// Convert float to space-padded string with -_23.4_ format
char
*
ftostr32sp
(
const
float
&
x
)
{
long
xx
=
abs
(
x
*
100
);
uint8_t
dig
;
if
(
x
<
0
)
{
// negative val = -_0
conv
[
0
]
=
'-'
;
dig
=
(
xx
/
1000
)
%
10
;
conv
[
1
]
=
dig
?
'0'
+
dig
:
' '
;
}
else
{
// positive val = __0
dig
=
(
xx
/
10000
)
%
10
;
if
(
dig
)
{
conv
[
0
]
=
'0'
+
dig
;
conv
[
1
]
=
'0'
+
(
xx
/
1000
)
%
10
;
}
else
{
conv
[
0
]
=
' '
;
dig
=
(
xx
/
1000
)
%
10
;
conv
[
1
]
=
dig
?
'0'
+
dig
:
' '
;
}
}
conv
[
2
]
=
'0'
+
(
xx
/
100
)
%
10
;
// lsd always
dig
=
xx
%
10
;
if
(
dig
)
{
// 2 decimal places
conv
[
5
]
=
'0'
+
dig
;
conv
[
4
]
=
'0'
+
(
xx
/
10
)
%
10
;
conv
[
3
]
=
'.'
;
}
else
{
// 1 or 0 decimal place
dig
=
(
xx
/
10
)
%
10
;
if
(
dig
)
{
conv
[
4
]
=
'0'
+
dig
;
conv
[
3
]
=
'.'
;
}
else
{
conv
[
3
]
=
conv
[
4
]
=
' '
;
}
conv
[
5
]
=
' '
;
}
conv
[
6
]
=
'\0'
;
return
conv
;
}
// Convert int to lj string with +123.0 format
char
*
itostr31
(
const
int
&
x
)
{
conv
[
0
]
=
x
>=
0
?
'+'
:
'-'
;
int
xx
=
abs
(
x
);
conv
[
1
]
=
(
xx
/
100
)
%
10
+
'0'
;
conv
[
2
]
=
(
xx
/
10
)
%
10
+
'0'
;
conv
[
3
]
=
xx
%
10
+
'0'
;
conv
[
4
]
=
'.'
;
conv
[
5
]
=
'0'
;
conv
[
6
]
=
0
;
return
conv
;
}
// Convert int to rj string with 123 or -12 format
char
*
itostr3
(
const
int
&
x
)
{
int
xx
=
x
;
if
(
xx
<
0
)
{
conv
[
0
]
=
'-'
;
xx
=
-
xx
;
}
else
conv
[
0
]
=
xx
>=
100
?
(
xx
/
100
)
%
10
+
'0'
:
' '
;
conv
[
1
]
=
xx
>=
10
?
(
xx
/
10
)
%
10
+
'0'
:
' '
;
conv
[
2
]
=
xx
%
10
+
'0'
;
conv
[
3
]
=
0
;
return
conv
;
}
// Convert int to lj string with 123 format
char
*
itostr3left
(
const
int
&
xx
)
{
if
(
xx
>=
100
)
{
conv
[
0
]
=
(
xx
/
100
)
%
10
+
'0'
;
conv
[
1
]
=
(
xx
/
10
)
%
10
+
'0'
;
conv
[
2
]
=
xx
%
10
+
'0'
;
conv
[
3
]
=
0
;
}
else
if
(
xx
>=
10
)
{
conv
[
0
]
=
(
xx
/
10
)
%
10
+
'0'
;
conv
[
1
]
=
xx
%
10
+
'0'
;
conv
[
2
]
=
0
;
}
else
{
conv
[
0
]
=
xx
%
10
+
'0'
;
conv
[
1
]
=
0
;
}
return
conv
;
}
// Convert int to rj string with 1234 format
char
*
itostr4
(
const
int
&
xx
)
{
conv
[
0
]
=
xx
>=
1000
?
(
xx
/
1000
)
%
10
+
'0'
:
' '
;
conv
[
1
]
=
xx
>=
100
?
(
xx
/
100
)
%
10
+
'0'
:
' '
;
conv
[
2
]
=
xx
>=
10
?
(
xx
/
10
)
%
10
+
'0'
:
' '
;
conv
[
3
]
=
xx
%
10
+
'0'
;
conv
[
4
]
=
0
;
return
conv
;
}
char
*
ltostr7
(
const
long
&
xx
)
{
if
(
xx
>=
1000000
)
conv
[
0
]
=
(
xx
/
1000000
)
%
10
+
'0'
;
else
conv
[
0
]
=
' '
;
if
(
xx
>=
100000
)
conv
[
1
]
=
(
xx
/
100000
)
%
10
+
'0'
;
else
conv
[
1
]
=
' '
;
if
(
xx
>=
10000
)
conv
[
2
]
=
(
xx
/
10000
)
%
10
+
'0'
;
else
conv
[
2
]
=
' '
;
if
(
xx
>=
1000
)
conv
[
3
]
=
(
xx
/
1000
)
%
10
+
'0'
;
else
conv
[
3
]
=
' '
;
if
(
xx
>=
100
)
conv
[
4
]
=
(
xx
/
100
)
%
10
+
'0'
;
else
conv
[
4
]
=
' '
;
if
(
xx
>=
10
)
conv
[
5
]
=
(
xx
/
10
)
%
10
+
'0'
;
else
conv
[
5
]
=
' '
;
conv
[
6
]
=
(
xx
)
%
10
+
'0'
;
conv
[
7
]
=
0
;
return
conv
;
}
// convert float to string with +123 format
char
*
ftostr30
(
const
float
&
x
)
{
int
xx
=
x
;
conv
[
0
]
=
(
xx
>=
0
)
?
'+'
:
'-'
;
xx
=
abs
(
xx
);
conv
[
1
]
=
(
xx
/
100
)
%
10
+
'0'
;
conv
[
2
]
=
(
xx
/
10
)
%
10
+
'0'
;
conv
[
3
]
=
(
xx
)
%
10
+
'0'
;
conv
[
4
]
=
0
;
return
conv
;
}
// Convert float to rj string with 12345 format
char
*
ftostr5
(
const
float
&
x
)
{
long
xx
=
abs
(
x
);
conv
[
0
]
=
xx
>=
10000
?
(
xx
/
10000
)
%
10
+
'0'
:
' '
;
conv
[
1
]
=
xx
>=
1000
?
(
xx
/
1000
)
%
10
+
'0'
:
' '
;
conv
[
2
]
=
xx
>=
100
?
(
xx
/
100
)
%
10
+
'0'
:
' '
;
conv
[
3
]
=
xx
>=
10
?
(
xx
/
10
)
%
10
+
'0'
:
' '
;
conv
[
4
]
=
xx
%
10
+
'0'
;
conv
[
5
]
=
0
;
return
conv
;
}
// Convert float to string with +1234.5 format
char
*
ftostr51
(
const
float
&
x
)
{
long
xx
=
abs
(
x
*
10
);
conv
[
0
]
=
(
x
>=
0
)
?
'+'
:
'-'
;
conv
[
1
]
=
(
xx
/
10000
)
%
10
+
'0'
;
conv
[
2
]
=
(
xx
/
1000
)
%
10
+
'0'
;
conv
[
3
]
=
(
xx
/
100
)
%
10
+
'0'
;
conv
[
4
]
=
(
xx
/
10
)
%
10
+
'0'
;
conv
[
5
]
=
'.'
;
conv
[
6
]
=
xx
%
10
+
'0'
;
conv
[
7
]
=
0
;
return
conv
;
}
// Convert float to string with +123.45 format
char
*
ftostr52
(
const
float
&
x
)
{
conv
[
0
]
=
(
x
>=
0
)
?
'+'
:
'-'
;
long
xx
=
abs
(
x
*
100
);
conv
[
1
]
=
(
xx
/
10000
)
%
10
+
'0'
;
conv
[
2
]
=
(
xx
/
1000
)
%
10
+
'0'
;
conv
[
3
]
=
(
xx
/
100
)
%
10
+
'0'
;
conv
[
4
]
=
'.'
;
conv
[
5
]
=
(
xx
/
10
)
%
10
+
'0'
;
conv
[
6
]
=
xx
%
10
+
'0'
;
conv
[
7
]
=
0
;
return
conv
;
}
#if DISABLED(DELTA) && DISABLED(Z_SAFE_HOMING) && Z_HOME_DIR < 0
static
void
lcd_level_bed
()
{
...
...
@@ -2088,13 +2365,17 @@ void lcd_reset_alert_level() { lcd_status_message_level = 0; }
#elif ENABLED(NEXTION)
#include "Marlin_main.h"
#if ENABLED(SDSUPPORT)
#include "cardreader.h"
#endif
#include "temperature.h"
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "vector_3.h"
#endif
#include "planner.h"
#include "stepper_indirection.h"
#include "stepper.h"
...
...
@@ -2108,6 +2389,11 @@ char buffer[100] = {0};
char
lcd_status_message
[
30
]
=
WELCOME_MSG
;
// worst case is kana with up to 3*LCD_WIDTH+1
uint8_t
lcd_status_message_level
=
0
;
// Page
NexPage
page0
=
NexPage
(
0
,
0
,
"start"
);
NexPage
page1
=
NexPage
(
1
,
0
,
"info"
);
NexPage
page2
=
NexPage
(
2
,
0
,
"settemp"
);
// Text
NexText
Hotend0
=
NexText
(
1
,
1
,
"t0"
);
NexText
Hotend1
=
NexText
(
1
,
4
,
"t1"
);
...
...
@@ -2141,10 +2427,12 @@ NexHotspot tup = NexHotspot(2, 16, "tup");
NexHotspot
tdown
=
NexHotspot
(
2
,
17
,
"tdown"
);
// Timer
NexTimer
startimer
=
NexTimer
(
0
,
1
,
"tm0"
);
NexTimer
fantimer
=
NexTimer
(
1
,
23
,
"tm0"
);
NexTouch
*
nex_listen_list
[]
=
{
&
page0
,
&
Menu
,
&
MSD
,
&
MSetup
,
...
...
@@ -2159,30 +2447,36 @@ NexTouch *nex_listen_list[] =
};
void
setpageInfo
()
{
sendCommand
(
"page info"
);
page1
.
show
(
);
PageInfo
=
true
;
#if HAS
(TEMP_0)
#if HAS
_TEMP_0
sendCommand
(
"he.val=1"
);
#endif
#if HAS
(TEMP_1)
#if HAS
_TEMP_1
sendCommand
(
"he.val=2"
);
#endif
#if HAS
(TEMP_2)
#if HAS
_TEMP_2
sendCommand
(
"he.val=3"
);
#elif HAS
(TEMP_BED)
#elif HAS
_TEMP_BED
Hotend21
.
setText
(
"BED"
);
sendCommand
(
"bed.val=1"
);
#endif
#if ENABLED(SDSUPPORT)
MSD
.
setPic
(
6
);
MSD
.
setPic
(
7
);
#endif
lcd_setstatus
(
lcd_status_message
);
}
void
page0PopCallback
(
void
*
ptr
)
{
setpageInfo
();
}
void
hotPopCallback
(
void
*
ptr
)
{
sendCommand
(
"page 2"
);
page2
.
show
(
);
PageInfo
=
false
;
memset
(
buffer
,
0
,
sizeof
(
buffer
));
if
(
ptr
==
&
hot0
)
{
...
...
@@ -2198,14 +2492,14 @@ void hotPopCallback(void *ptr) {
set1
.
setText
(
"M104 T1 S"
);
}
#if HAS
(TEMP_2)
#if HAS
_TEMP_2
if
(
ptr
==
&
hot2
)
{
if
(
degTargetHotend
(
2
)
!=
0
)
{
itoa
(
degTargetHotend
(
2
),
buffer
,
10
);
}
set1
.
setText
(
"M104 T2 S"
);
}
#elif HAS
(TEMP_BED)
#elif HAS
_TEMP_BED
if
(
ptr
==
&
hot2
)
{
if
(
degTargetBed
()
!=
0
)
{
itoa
(
degTargetBed
(),
buffer
,
10
);
...
...
@@ -2239,7 +2533,6 @@ void sethotPopCallback(void *ptr) {
set1
.
getText
(
buffer
,
sizeof
(
buffer
));
enqueuecommands_P
(
buffer
);
setpageInfo
();
lcd_setstatus
(
lcd_status_message
);
}
void
setpagePopCallback
(
void
*
ptr
)
{
...
...
@@ -2261,19 +2554,23 @@ millis_t next_lcd_update_ms;
void
lcd_init
()
{
NextionON
=
nexInit
();
if
(
!
NextionON
)
{
ECHO_LM
(
ER
,
"Nextion LCD not connected!"
);
ECHO_LM
(
DB
,
"Nextion LCD not connected!"
);
}
else
{
ECHO_LM
(
DB
,
"Nextion LCD connected!"
);
#if HAS(TEMP_0)
page0
.
attachPop
(
page0PopCallback
);
#if HAS_TEMP_0
hot0
.
attachPop
(
hotPopCallback
,
&
hot0
);
#endif
#if HAS
(TEMP_1)
#if HAS
_TEMP_1
hot1
.
attachPop
(
hotPopCallback
,
&
hot1
);
#endif
#if HAS
(TEMP_2) || HAS(TEMP_BED)
#if HAS
_TEMP_2 || HAS_TEMP_BED
hot2
.
attachPop
(
hotPopCallback
,
&
hot2
);
#endif
Menu
.
attachPop
(
setpagePopCallback
,
&
Menu
);
MSD
.
attachPop
(
setpagePopCallback
,
&
MSD
);
MSetup
.
attachPop
(
setpagePopCallback
,
&
Menu
);
...
...
@@ -2281,9 +2578,7 @@ void lcd_init() {
m11
.
attachPop
(
sethotPopCallback
,
&
m11
);
tup
.
attachPop
(
settempPopCallback
,
&
tup
);
tdown
.
attachPop
(
settempPopCallback
,
&
tdown
);
delay
(
SPLASH_SCREEN_DURATION
);
// wait to display the splash screen
setpageInfo
();
lcd_setstatus
(
WELCOME_MSG
);
startimer
.
enable
();
}
}
...
...
@@ -2382,15 +2677,15 @@ void lcd_update() {
if
(
fanSpeed
>
0
)
fantimer
.
enable
();
else
fantimer
.
disable
();
#if HAS
(TEMP_0)
#if HAS
_TEMP_0
temptoLCD
(
0
,
degHotend
(
0
),
degTargetHotend
(
0
));
#endif
#if HAS
(TEMP_1)
#if HAS
_TEMP_1
temptoLCD
(
1
,
degHotend
(
1
),
degTargetHotend
(
1
));
#endif
#if HAS
(TEMP_2)
#if HAS
_TEMP_2
temptoLCD
(
2
,
degHotend
(
2
),
degTargetHotend
(
2
));
#elif HAS
(TEMP_BED)
#elif HAS
_TEMP_BED
temptoLCD
(
2
,
degBed
(),
degTargetBed
());
#endif
...
...
@@ -2420,8 +2715,6 @@ void lcd_setalertstatuspgm(const char* message) {
void
lcd_reset_alert_level
()
{
lcd_status_message_level
=
0
;
}
#endif //ULTRA_LCD
/*********************************/
/** Number to string conversion **/
/*********************************/
...
...
@@ -2699,6 +2992,8 @@ char *ftostr52(const float &x) {
return
conv
;
}
#endif //ULTRA_LCD
#if ENABLED(SDSUPPORT) && ENABLED(SD_SETTINGS)
void
set_sd_dot
()
{
#if ENABLED(DOGLCD)
...
...
MarlinKimbra/ultralcd.h
View file @
c9fc2819
...
...
@@ -111,8 +111,9 @@
#elif ENABLED(NEXTION)
#define LCD_UPDATE_INTERVAL
2
00
#define LCD_UPDATE_INTERVAL
1
00
void
page0PopCallback
(
void
*
ptr
);
void
setpagePopCallback
(
void
*
ptr
);
void
hotPopCallback
(
void
*
ptr
);
void
sethotPopCallback
(
void
*
ptr
);
...
...
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