Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dvfs-genomic-sequencing-smartpower2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sigurd Hagen Tullander
dvfs-genomic-sequencing-smartpower2
Commits
1ba0430c
Commit
1ba0430c
authored
8 years ago
by
John Lee
Browse files
Options
Downloads
Patches
Plain Diff
16x2lcd: add text sliding
parent
2676eadf
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
data/index.html
+1
-1
1 addition, 1 deletion
data/index.html
src/smartpower2.ino
+101
-55
101 additions, 55 deletions
src/smartpower2.ino
with
102 additions
and
56 deletions
data/index.html
+
1
−
1
View file @
1ba0430c
...
@@ -160,7 +160,7 @@
...
@@ -160,7 +160,7 @@
<label
for=
"text-10"
style=
"margin:15px 10px 0 0; text-align:right;"
>
Build date
</label>
<label
for=
"text-10"
style=
"margin:15px 10px 0 0; text-align:right;"
>
Build date
</label>
</div>
</div>
<div
class=
"ui-block-d"
>
<div
class=
"ui-block-d"
>
<input
data-mini=
"true"
disabled=
"disabled"
id=
"text-10"
value=
"16
0914
"
type=
"text"
>
<input
data-mini=
"true"
disabled=
"disabled"
id=
"text-10"
value=
"16
1206
"
type=
"text"
>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
src/smartpower2.ino
+
101
−
55
View file @
1ba0430c
...
@@ -12,6 +12,9 @@
...
@@ -12,6 +12,9 @@
#define USE_SERIAL Serial
#define USE_SERIAL Serial
#define MAX_LCD_SSID_LENGTH 12
#define MAX_LCD_IP_LENGTH 14
#define ON 0
#define ON 0
#define OFF 1
#define OFF 1
#define HOME 0
#define HOME 0
...
@@ -275,7 +278,6 @@ void handleClientData(uint8_t num, String data)
...
@@ -275,7 +278,6 @@ void handleClientData(uint8_t num, String data)
sendStatus
(
i
,
1
);
sendStatus
(
i
,
1
);
}
}
}
}
break
;
break
;
}
}
case
MEASUREWATTHOUR
:
case
MEASUREWATTHOUR
:
...
@@ -312,15 +314,16 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght
...
@@ -312,15 +314,16 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght
break
;
break
;
case
WStype_CONNECTED
:
{
case
WStype_CONNECTED
:
{
IPAddress
ip
=
webSocket
.
remoteIP
(
num
);
IPAddress
ip
=
webSocket
.
remoteIP
(
num
);
USE_SERIAL
.
printf
(
"[%u] Connected from %d.%d.%d.%d url: %s
\n\r
"
,
num
,
ip
[
0
],
ip
[
1
],
ip
[
2
],
ip
[
3
],
payload
);
USE_SERIAL
.
printf
(
"[%u] Connected from %d.%d.%d.%d url: %s
\n\r
"
,
num
,
ip
[
0
],
ip
[
1
],
ip
[
2
],
ip
[
3
],
payload
);
client_sp2
[
num
].
connected
=
1
;
client_sp2
[
num
].
connected
=
1
;
connectedWeb
=
1
;
connectedWeb
=
1
;
}
break
;
break
;
}
case
WStype_TEXT
:
{
case
WStype_TEXT
:
{
handleClientData
(
num
,
String
((
char
*
)
&
payload
[
0
]));
handleClientData
(
num
,
String
((
char
*
)
&
payload
[
0
]));
}
break
;
break
;
}
case
WStype_BIN
:
case
WStype_BIN
:
USE_SERIAL
.
printf
(
"[%u] get binary lenght: %u
\n\r
"
,
num
,
lenght
);
USE_SERIAL
.
printf
(
"[%u] get binary lenght: %u
\n\r
"
,
num
,
lenght
);
hexdump
(
payload
,
lenght
);
hexdump
(
payload
,
lenght
);
...
@@ -436,39 +439,82 @@ void printPower_LCD(void)
...
@@ -436,39 +439,82 @@ void printPower_LCD(void)
if
(
watth
<
10
)
{
if
(
watth
<
10
)
{
lcd
.
print
(
watth
,
3
);
lcd
.
print
(
watth
,
3
);
lcd
.
print
(
" "
);
}
else
if
(
watth
<
100
)
{
}
else
if
(
watth
<
100
)
{
lcd
.
print
(
watth
,
2
);
lcd
.
print
(
watth
,
2
);
}
else
{
lcd
.
print
(
" "
);
}
else
if
(
watth
<
1000
)
{
lcd
.
print
(
watth
,
1
);
lcd
.
print
(
watth
,
1
);
lcd
.
print
(
" "
);
}
else
{
lcd
.
print
(
watth
/
1000
,
0
);
lcd
.
print
(
" K"
);
}
}
lcd
.
print
(
"Wh "
);
lcd
.
print
(
"Wh "
);
}
}
uint8_t
cnt_ssid
;
uint8_t
cnt_ssid
;
uint8_t
cursor_lcd
;
int8_t
cnt_ip
;
int8_t
cursor_ssid
;
int8_t
cursor_ip
;
void
printInfo_LCD
(
void
)
void
printInfo_LCD
(
void
)
{
{
for
(
int
i
=
0
;
i
<
30
;
i
++
)
{
String
str
;
if
(
ssid
[
i
]
==
'\0'
)
{
int
i
;
cnt_ssid
=
i
;
cnt_ssid
=
String
(
ssid
).
length
();
break
;
}
}
lcd
.
setCursor
(
0
,
0
);
lcd
.
setCursor
(
0
,
0
);
lcd
.
print
(
"SSID:"
);
lcd
.
print
(
"SSID:"
);
lcd
.
print
(
ssid
);
str
=
String
(
ssid
);
if
(
cnt_ssid
<
11
)
{
if
(
cnt_ssid
<
MAX_LCD_SSID_LENGTH
)
{
for
(
int
i
=
0
;
i
<
11
-
cnt_ssid
;
i
++
)
{
lcd
.
print
(
str
);
for
(
i
=
0
;
i
<
MAX_LCD_SSID_LENGTH
;
i
++
)
{
lcd
.
print
(
" "
);
}
}
else
{
if
((
cursor_ssid
-
5
)
==
cnt_ssid
)
{
cursor_ssid
=
0
;
}
lcd
.
print
(
str
.
substring
(
cursor_ssid
++
));
if
((
cnt_ssid
-
cursor_ssid
)
<
MAX_LCD_SSID_LENGTH
-
5
)
{
if
(
cnt_ssid
<
cursor_ssid
)
{
for
(
i
=
0
;
i
<
6
-
(
cursor_ssid
-
cnt_ssid
);
i
++
)
lcd
.
print
(
" "
);
}
else
{
lcd
.
print
(
" "
);
}
lcd
.
print
(
str
);
}
else
if
((
cnt_ssid
-
cursor_ssid
)
<
MAX_LCD_SSID_LENGTH
)
{
for
(
i
=
0
;
i
<
MAX_LCD_SSID_LENGTH
-
(
cnt_ssid
-
cursor_ssid
);
i
++
)
lcd
.
print
(
" "
);
lcd
.
print
(
" "
);
}
}
}
}
lcd
.
setCursor
(
0
,
1
);
lcd
.
setCursor
(
0
,
1
);
lcd
.
print
(
"IP:"
);
lcd
.
print
(
"IP:"
);
cnt_ip
=
ip
.
toString
().
length
();
if
(
cnt_ip
<
MAX_LCD_IP_LENGTH
)
{
lcd
.
print
(
ip
.
toString
());
for
(
i
=
0
;
i
<
MAX_LCD_IP_LENGTH
-
cnt_ip
;
i
++
)
lcd
.
print
(
" "
);
}
else
{
if
((
cursor_ip
-
5
)
==
cnt_ip
)
{
cursor_ip
=
0
;
}
lcd
.
print
(
ip
.
toString
().
substring
(
cursor_ip
++
));
if
((
cnt_ip
-
cursor_ip
)
<
MAX_LCD_IP_LENGTH
-
5
)
{
if
(
cnt_ip
<
cursor_ip
)
{
for
(
i
=
0
;
i
<
6
-
(
cursor_ip
-
cnt_ip
);
i
++
)
lcd
.
print
(
" "
);
}
else
{
lcd
.
print
(
" "
);
}
lcd
.
print
(
ip
.
toString
());
lcd
.
print
(
ip
.
toString
());
}
else
if
((
cnt_ip
-
cursor_ip
)
<
MAX_LCD_IP_LENGTH
)
{
for
(
i
=
0
;
i
<
MAX_LCD_IP_LENGTH
-
(
cnt_ip
-
cursor_ip
);
i
++
)
lcd
.
print
(
" "
);
lcd
.
print
(
" "
);
}
}
}
}
void
readPower
(
void
)
void
readPower
(
void
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment