update to SN mode
This commit is contained in:
parent
a3dc135d70
commit
80a0ce5852
|
@ -0,0 +1 @@
|
|||
factory_info.h
|
|
@ -14,6 +14,4 @@ public:
|
|||
void SetWifiSsid(String ssid);
|
||||
String GetWifiPasswd();
|
||||
void SetWifiPasswd(String password);
|
||||
String GetDeviceUuid();
|
||||
void SetDeviceUuid(String uuid);
|
||||
};
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Topuino</title>
|
||||
<meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=no' />
|
||||
<link rel='shortcut icon' href='data:,'>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style='text-align: center; font-size: 40px'>Topuino Config Page</h1>
|
||||
<form action='/setup' method='POST'>
|
||||
<div style='text-align: center'>
|
||||
<div style='font-size: 20px; margin-bottom: 15px'>
|
||||
<label for='ssid'><b>Wi-Fi SSID</b></label>
|
||||
<input type='text' name='ssid' required>
|
||||
</div>
|
||||
<div style='font-size: 20px; margin-bottom: 15px'>
|
||||
<label for='psw'><b>Wi-Fi Password</b></label>
|
||||
<input type='password' name='psw' required>
|
||||
</div>
|
||||
<div style='font-size: 20px; margin-bottom: 15px'>
|
||||
<label for='uuid'><b>Device ID</b></label>
|
||||
<input type='text' name='uuid' required>
|
||||
</div>
|
||||
<div style='font-size: 20px'>
|
||||
<button type='submit'>Commit</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -2,6 +2,7 @@
|
|||
#include "status_blink.h"
|
||||
#include "user_data.h"
|
||||
#include "func_button.h"
|
||||
#include "factory_info.h"
|
||||
|
||||
extern StatusBlink* statusLed;
|
||||
extern UserData* userdataManager;
|
||||
|
@ -18,8 +19,8 @@ ClientNetwork::ClientNetwork()
|
|||
funcButton->Scan();
|
||||
}
|
||||
statusLed->SetBlinkRate(StatusBlink::BlinkRate::RateAlwaysOff);
|
||||
url = "http://iot.vvzero.com/topuino/getdata?UUID=";
|
||||
url += userdataManager->GetDeviceUuid();
|
||||
url = "http://iot.vvzero.com/topuino/getdata?SN=";
|
||||
url += DEVICE_SN;
|
||||
status = FAIL;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,10 +29,6 @@ static String configPage("\
|
|||
<label for='psw'><b>Wi-Fi Password</b></label>\
|
||||
<input type='password' name='psw' required>\
|
||||
</div>\
|
||||
<div style='font-size: 20px; margin-bottom: 15px'>\
|
||||
<label for='uuid'><b>Device ID</b></label>\
|
||||
<input type='text' name='uuid' required>\
|
||||
</div>\
|
||||
<div style='font-size: 20px'>\
|
||||
<button type='submit'>Commit</button>\
|
||||
</div>\
|
||||
|
@ -50,10 +46,9 @@ static void handleOnConnect()
|
|||
|
||||
static void handleOnCommit()
|
||||
{
|
||||
if (configManager->httpServer.hasArg("ssid") && configManager->httpServer.hasArg("psw") && configManager->httpServer.hasArg("uuid")) {
|
||||
if (configManager->httpServer.hasArg("ssid") && configManager->httpServer.hasArg("psw")) {
|
||||
userdataManager->SetWifiSsid(configManager->httpServer.arg("ssid"));
|
||||
userdataManager->SetWifiPasswd(configManager->httpServer.arg("psw"));
|
||||
userdataManager->SetDeviceUuid(configManager->httpServer.arg("uuid"));
|
||||
userdataManager->ConfirmData();
|
||||
configManager->httpServer.send(200, "text/html", "OK");
|
||||
delay(200);
|
||||
|
|
22
src/main.cpp
22
src/main.cpp
|
@ -34,13 +34,19 @@ void loop()
|
|||
delay(1000);
|
||||
funcButton->Scan();
|
||||
|
||||
if (netClient->FetchNewData() != OK) {
|
||||
return;
|
||||
if (netClient->FetchNewData() == OK) {
|
||||
displayPanel->DisplayCpuPercent(netClient->GetPercent(CPU_PERCENT));
|
||||
displayPanel->DisplayMemPercent(netClient->GetPercent(MEM_PERCENT));
|
||||
displayPanel->DisplayDisk0Percent(netClient->GetPercent(DISK0_PERCENT));
|
||||
displayPanel->DisplayDisk1Percent(netClient->GetPercent(DISK1_PERCENT));
|
||||
displayPanel->DisplayDiskRate(netClient->GetRate(DISK_READ_RATE), netClient->GetRate(DISK_WRITE_RATE));
|
||||
displayPanel->DisplayNetRate(netClient->GetRate(NET_SENT_RATE), netClient->GetRate(NET_RECV_RATE));
|
||||
} else {
|
||||
displayPanel->DisplayCpuPercent(0);
|
||||
displayPanel->DisplayMemPercent(0);
|
||||
displayPanel->DisplayDisk0Percent(0);
|
||||
displayPanel->DisplayDisk1Percent(0);
|
||||
displayPanel->DisplayDiskRate(0, 0);
|
||||
displayPanel->DisplayNetRate(0, 0);
|
||||
}
|
||||
displayPanel->DisplayCpuPercent(netClient->GetPercent(CPU_PERCENT));
|
||||
displayPanel->DisplayMemPercent(netClient->GetPercent(MEM_PERCENT));
|
||||
displayPanel->DisplayDisk0Percent(netClient->GetPercent(DISK0_PERCENT));
|
||||
displayPanel->DisplayDisk1Percent(netClient->GetPercent(DISK1_PERCENT));
|
||||
displayPanel->DisplayDiskRate(netClient->GetRate(DISK_READ_RATE), netClient->GetRate(DISK_WRITE_RATE));
|
||||
displayPanel->DisplayNetRate(netClient->GetRate(NET_SENT_RATE), netClient->GetRate(NET_RECV_RATE));
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
#define VALIDATION_OFFSET 0x00
|
||||
#define SSID_OFFSET 0x20
|
||||
#define PASSWORD_OFFSET 0x40
|
||||
#define UUID_OFFSET 0x60
|
||||
|
||||
UserData::UserData()
|
||||
{
|
||||
|
@ -73,13 +72,3 @@ void UserData::SetWifiPasswd(String password)
|
|||
{
|
||||
return WriteEepromString(password, PASSWORD_OFFSET);
|
||||
}
|
||||
|
||||
String UserData::GetDeviceUuid()
|
||||
{
|
||||
return ReadEepromString(UUID_OFFSET);
|
||||
}
|
||||
|
||||
void UserData::SetDeviceUuid(String uuid)
|
||||
{
|
||||
return WriteEepromString(uuid, UUID_OFFSET);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue