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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sigurd Hagen Tullander
dvfs-genomic-sequencing-smartpower2
Commits
d34f7209
Commit
d34f7209
authored
Jan 18, 2017
by
OtherCrashOverride
Committed by
Seungchul Lee
Jan 20, 2017
Browse files
Options
Downloads
Patches
Plain Diff
Add console logging.
parent
1ba0430c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
platformio.ini
+4
-0
4 additions, 0 deletions
platformio.ini
src/smartpower2.ino
+48
-0
48 additions, 0 deletions
src/smartpower2.ino
with
52 additions
and
0 deletions
platformio.ini
+
4
−
0
View file @
d34f7209
...
@@ -25,3 +25,7 @@ board = esp12e
...
@@ -25,3 +25,7 @@ board = esp12e
upload_speed
=
921600
upload_speed
=
921600
board_f_cpu
=
160000000L
board_f_cpu
=
160000000L
build_flags
=
-Wl,-Tesp8266.flash.4m.ld
build_flags
=
-Wl,-Tesp8266.flash.4m.ld
lib_deps
=
WebSockets
Simpletimer
LiquidCrystal_I2C
This diff is collapsed.
Click to expand it.
src/smartpower2.ino
+
48
−
0
View file @
d34f7209
...
@@ -10,6 +10,11 @@
...
@@ -10,6 +10,11 @@
#include
<mcp4652.h>
#include
<mcp4652.h>
#include
<LiquidCrystal_I2C.h>
#include
<LiquidCrystal_I2C.h>
#define CONSOLE_PORT 23
WiFiServer
logServer
(
CONSOLE_PORT
);
WiFiClient
logClient
;
#define USE_SERIAL Serial
#define USE_SERIAL Serial
#define MAX_LCD_SSID_LENGTH 12
#define MAX_LCD_SSID_LENGTH 12
...
@@ -110,12 +115,46 @@ void setup() {
...
@@ -110,12 +115,46 @@ void setup() {
webserver_init
();
webserver_init
();
timerId
=
timer
.
setInterval
(
1000
,
handler
);
timerId
=
timer
.
setInterval
(
1000
,
handler
);
// Log
logServer
.
begin
();
logServer
.
setNoDelay
(
true
);
}
}
void
loop
()
{
void
loop
()
{
server
.
handleClient
();
server
.
handleClient
();
webSocket
.
loop
();
webSocket
.
loop
();
timer
.
run
();
timer
.
run
();
if
(
logServer
.
hasClient
())
{
// A connection attempt is being made
if
(
!
logClient
)
{
// This is the first client to connect
logClient
=
logServer
.
available
();
}
else
{
if
(
!
logClient
.
connected
())
{
// A previous client has disconnected.
// Connect the new client.
logClient
.
stop
();
logClient
=
logServer
.
available
();
}
else
{
// A client connection is already in use.
// Drop the new connection attempt.
WiFiClient
tempClient
=
logServer
.
available
();
tempClient
.
stop
();
}
}
}
}
}
void
webserver_init
(
void
)
void
webserver_init
(
void
)
...
@@ -667,6 +706,15 @@ void handler(void)
...
@@ -667,6 +706,15 @@ void handler(void)
}
}
}
}
if
(
logClient
&&
logClient
.
connected
())
{
// Report the log info
String
data
=
String
(
volt
)
+
","
+
String
(
ampere
)
+
","
+
String
(
watt
,
3
)
+
","
+
String
(
watth
/
3600
,
3
)
+
"
\r\n
"
;
logClient
.
write
(
data
.
c_str
());
}
lcd_status
();
lcd_status
();
wifi_connection_status
();
wifi_connection_status
();
readSystemReset
();
readSystemReset
();
...
...
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
sign in
to comment