Giter Site home page Giter Site logo

v0.2 about esp-rfid HOT 8 CLOSED

esprfid avatar esprfid commented on May 11, 2024
v0.2

from esp-rfid.

Comments (8)

rneurink avatar rneurink commented on May 11, 2024

I've fixed the status command in AP mode. The only thing i couldn't find is how to get the dns server when in AP mode

Uploaded to my fork

`
#ifdef ESP8266
extern "C" {
#include "user_interface.h" // Used to get Wifi status information
}
#endif

void sendStatus() {
DynamicJsonBuffer jsonBuffer;
JsonObject& root = jsonBuffer.createObject();
int mode = WiFi.getMode(); //const char* modes[] = { "NULL", "STA", "AP", "STA+AP" };

struct ip_info info;

if (mode == 1) { //Station mode
	wifi_get_ip_info(STATION_IF, &info);
	struct station_config conf;
	wifi_station_get_config(&conf);
	root["ssid"] = String(reinterpret_cast<char*>(conf.ssid));
	root["dns"] = printIP(WiFi.dnsIP());
	root["mac"] = WiFi.macAddress();
} else if (mode == 2) { //SoftAP mode
	wifi_get_ip_info(SOFTAP_IF, &info);
	struct softap_config conf;
	wifi_softap_get_config(&conf);
	root["ssid"] = String(reinterpret_cast<char*>(conf.ssid));
	root["dns"] = "";
	root["mac"] = WiFi.softAPmacAddress();
}
IPAddress ipaddr = IPAddress(info.ip.addr);
IPAddress gwaddr = IPAddress(info.gw.addr);
IPAddress nmaddr = IPAddress(info.netmask.addr);
root["ip"] = printIP(ipaddr);
root["gateway"] = printIP(gwaddr);
root["netmask"] = printIP(nmaddr);

root["command"] = "status";
root["heap"] = ESP.getFreeHeap();
root["chipid"] = String(ESP.getChipId(), HEX);
root["cpu"] = ESP.getCpuFreqMHz();
root["availsize"] = ESP.getFreeSketchSpace();

size_t len = root.measureLength();
AsyncWebSocketMessageBuffer * buffer = ws.makeBuffer(len); //  creates a buffer (len + 1) for you.
if (buffer) {
	root.printTo((char *)buffer->get(), len + 1);
	ws.textAll(buffer);
}
}

`

from esp-rfid.

rneurink avatar rneurink commented on May 11, 2024

give access untill specific date is also included in my fork Commit

from esp-rfid.

rneurink avatar rneurink commented on May 11, 2024

added visualisation to see how much spiffs space is available commit

I was thinking is it not more logical to display space used instead of space available?

it also might be nice to notify the user when SPIFFS is almost full (in user.htm)

from esp-rfid.

omersiar avatar omersiar commented on May 11, 2024

Nicely done thank you. I even did not understand how ESP8266 memory mapped. Heap and Flash calculations are just my assumptions based on Arduino IDE compile time feedback.

Most development boards have 16Mbit (4MB) flash. I believe we can get info about SPIFFS then make calculations.

struct FSInfo {
    size_t totalBytes;
    size_t usedBytes;

http://esp8266.github.io/Arduino/versions/2.0.0/doc/filesystem.html#info

I am stuck on Time. Timezones, UTC, GMT, conversions one from another, Day Light Saving (Summer Time) all these stuff making me pull my hair. I think i am going to give up on timing for now, and focus on fun stuff.

from esp-rfid.

rneurink avatar rneurink commented on May 11, 2024

I've got the time from the ntpclient for now and it works fine. i've got a variable in which the UTC timezone can be set and it will adjust.
For the SPIFFS mapping i am indeed using FSInfo. this is however an estimate and is not perfectly correct but it is good enough for this use.

I am currently cleaning and testing my code. I though it might be usefull to come up with a general layout for the .ini file so it's easier to add and remove code.

from esp-rfid.

rneurink avatar rneurink commented on May 11, 2024

The memory is not that hard to understand. I'm using the esp12 which has 4M memory
in the arduino IDE you have an option for example "Flash size: 4M (3M SPIFFS)"
the first 1M is used for the .ini file (flash)
the other 3M is used for SPIFFS
Heap is not located in program memory but in data memory (SRAM) so that's another part. This will not conflict with program memory
The way you get the remaining flash space is good so nothing to worry about here. I'm not sure yet if "1044464" in the set.js file is correct though. There might be a way to check this in runtime

from esp-rfid.

omersiar avatar omersiar commented on May 11, 2024

I did not mean flash memory but random access memory.

https://github.com/esp8266/esp8266-wiki/wiki/Memory-Map

Just finished my NTP code, too both Javascript and ino. https://github.com/gmag11/NtpClient using this library now.

It's an overkill but at least does not throw exceptions as TimeLib

from esp-rfid.

omersiar avatar omersiar commented on May 11, 2024

@rneurink Thank you, it means a lot. 👍

Also shifted some goals to v0.4. This issue now can be closed.

from esp-rfid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.