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
0c032b35
Commit
0c032b35
authored
7 years ago
by
Kyle Lee
Browse files
Options
Downloads
Patches
Plain Diff
Fix compile errors
parent
6c7f2662
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/smartpower2.ino
+14
-14
14 additions, 14 deletions
src/smartpower2.ino
with
14 additions
and
14 deletions
src/smartpower2.ino
+
14
−
14
View file @
0c032b35
...
@@ -41,7 +41,7 @@ WiFiClient logClient;
...
@@ -41,7 +41,7 @@ WiFiClient logClient;
#define MEASUREWATTHOUR 'm'
#define MEASUREWATTHOUR 'm'
#define FW_VERSION 'f'
#define FW_VERSION 'f'
#define FWversion 1.
2
#define FWversion 1.
3
uint8_t
onoff
=
OFF
;
uint8_t
onoff
=
OFF
;
unsigned
char
measureWh
;
unsigned
char
measureWh
;
...
@@ -66,7 +66,7 @@ double watth;
...
@@ -66,7 +66,7 @@ double watth;
#define MAX_SRV_CLIENTS 1
#define MAX_SRV_CLIENTS 1
ESP8266WebServer
server
;
ESP8266WebServer
*
server
;
WebSocketsServer
webSocket
=
WebSocketsServer
(
81
);
WebSocketsServer
webSocket
=
WebSocketsServer
(
81
);
IPAddress
ip
=
IPAddress
(
192
,
168
,
4
,
1
);
IPAddress
ip
=
IPAddress
(
192
,
168
,
4
,
1
);
...
@@ -125,7 +125,7 @@ void setup() {
...
@@ -125,7 +125,7 @@ void setup() {
}
}
void
loop
()
{
void
loop
()
{
server
.
handleClient
();
server
->
handleClient
();
webSocket
.
loop
();
webSocket
.
loop
();
timer
.
run
();
timer
.
run
();
...
@@ -184,14 +184,14 @@ void webserver_init(void)
...
@@ -184,14 +184,14 @@ void webserver_init(void)
webSocket
.
begin
();
webSocket
.
begin
();
webSocket
.
onEvent
(
webSocketEvent
);
webSocket
.
onEvent
(
webSocketEvent
);
server
.
on
(
"/list"
,
HTTP_GET
,
handleFileList
);
server
->
on
(
"/list"
,
HTTP_GET
,
handleFileList
);
//use it to load content from SPIFFS
//use it to load content from SPIFFS
server
.
onNotFound
([](){
server
->
onNotFound
([](){
if
(
!
handleFileRead
(
server
.
uri
()))
if
(
!
handleFileRead
(
server
->
uri
()))
server
.
send
(
404
,
"text/plain"
,
"FileNotFound"
);
server
->
send
(
404
,
"text/plain"
,
"FileNotFound"
);
});
});
server
.
begin
();
server
->
begin
();
USE_SERIAL
.
println
(
"HTTP server started"
);
USE_SERIAL
.
println
(
"HTTP server started"
);
}
}
...
@@ -210,7 +210,7 @@ String formatBytes(size_t bytes){
...
@@ -210,7 +210,7 @@ String formatBytes(size_t bytes){
}
}
String
getContentType
(
String
filename
)
{
String
getContentType
(
String
filename
)
{
if
(
server
.
hasArg
(
"download"
))
return
"application/octet-stream"
;
if
(
server
->
hasArg
(
"download"
))
return
"application/octet-stream"
;
else
if
(
filename
.
endsWith
(
".htm"
))
return
"text/html"
;
else
if
(
filename
.
endsWith
(
".htm"
))
return
"text/html"
;
else
if
(
filename
.
endsWith
(
".html"
))
return
"text/html"
;
else
if
(
filename
.
endsWith
(
".html"
))
return
"text/html"
;
else
if
(
filename
.
endsWith
(
".js"
))
return
"application/javascript"
;
else
if
(
filename
.
endsWith
(
".js"
))
return
"application/javascript"
;
...
@@ -231,7 +231,7 @@ bool handleFileRead(String path) {
...
@@ -231,7 +231,7 @@ bool handleFileRead(String path) {
if
(
SPIFFS
.
exists
(
pathWithGz
))
if
(
SPIFFS
.
exists
(
pathWithGz
))
path
+=
".gz"
;
path
+=
".gz"
;
File
file
=
SPIFFS
.
open
(
path
,
"r"
);
File
file
=
SPIFFS
.
open
(
path
,
"r"
);
size_t
sent
=
server
.
streamFile
(
file
,
contentType
);
size_t
sent
=
server
->
streamFile
(
file
,
contentType
);
file
.
close
();
file
.
close
();
return
true
;
return
true
;
}
}
...
@@ -240,8 +240,8 @@ bool handleFileRead(String path) {
...
@@ -240,8 +240,8 @@ bool handleFileRead(String path) {
}
}
void
handleFileList
()
{
void
handleFileList
()
{
if
(
!
server
.
hasArg
(
"dir"
))
{
server
.
send
(
500
,
"text/plain"
,
"BAD ARGS"
);
return
;}
if
(
!
server
->
hasArg
(
"dir"
))
{
server
->
send
(
500
,
"text/plain"
,
"BAD ARGS"
);
return
;}
String
path
=
server
.
arg
(
"dir"
);
String
path
=
server
->
arg
(
"dir"
);
Serial
.
println
(
"handleFileList: "
+
path
);
Serial
.
println
(
"handleFileList: "
+
path
);
Dir
dir
=
SPIFFS
.
openDir
(
path
);
Dir
dir
=
SPIFFS
.
openDir
(
path
);
path
=
String
();
path
=
String
();
...
@@ -260,7 +260,7 @@ void handleFileList() {
...
@@ -260,7 +260,7 @@ void handleFileList() {
}
}
output
+=
"]"
;
output
+=
"]"
;
server
.
send
(
200
,
"text/json"
,
output
);
server
->
send
(
200
,
"text/json"
,
output
);
}
}
void
handleClientData
(
uint8_t
num
,
String
data
)
void
handleClientData
(
uint8_t
num
,
String
data
)
...
@@ -418,7 +418,7 @@ void readNetworkConfig(void)
...
@@ -418,7 +418,7 @@ void readNetworkConfig(void)
ipaddr
[
2
]
=
f
.
readStringUntil
(
'.'
).
toInt
();
ipaddr
[
2
]
=
f
.
readStringUntil
(
'.'
).
toInt
();
ipaddr
[
3
]
=
f
.
readStringUntil
(
'"'
).
toInt
();
ipaddr
[
3
]
=
f
.
readStringUntil
(
'"'
).
toInt
();
ip
=
IPAddress
(
ipaddr
[
0
],
ipaddr
[
1
],
ipaddr
[
2
],
ipaddr
[
3
]);
ip
=
IPAddress
(
ipaddr
[
0
],
ipaddr
[
1
],
ipaddr
[
2
],
ipaddr
[
3
]);
server
=
ESP8266WebServer
(
ip
,
80
);
server
=
new
ESP8266WebServer
(
ip
,
80
);
f
.
findUntil
(
"passwd"
,
"
\n\r
"
);
f
.
findUntil
(
"passwd"
,
"
\n\r
"
);
f
.
seek
(
2
,
SeekCur
);
f
.
seek
(
2
,
SeekCur
);
...
...
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