affichage valeur Analogique
Suppression Control Led bleue Affichage V Analog
This commit is contained in:
parent
4420ee7670
commit
2f3f010d34
|
@ -62,7 +62,6 @@
|
||||||
|
|
||||||
#define BLINK_LED_MS 50 // 50 ms blink
|
#define BLINK_LED_MS 50 // 50 ms blink
|
||||||
#define RGB_LED_PIN 14
|
#define RGB_LED_PIN 14
|
||||||
#define BLU_LED_PIN 1
|
|
||||||
#define RED_LED_PIN 12
|
#define RED_LED_PIN 12
|
||||||
// value for RGB color
|
// value for RGB color
|
||||||
#define COLOR_RED rgb_brightness, 0, 0
|
#define COLOR_RED rgb_brightness, 0, 0
|
||||||
|
@ -74,8 +73,13 @@
|
||||||
#define COLOR_MAGENTA rgb_brightness, 0, rgb_brightness
|
#define COLOR_MAGENTA rgb_brightness, 0, rgb_brightness
|
||||||
|
|
||||||
// GPIO 1 TX on board blue led
|
// GPIO 1 TX on board blue led
|
||||||
|
#ifdef BLU_LED_PIN
|
||||||
#define LedBluON() {digitalWrite(BLU_LED_PIN, 0);}
|
#define LedBluON() {digitalWrite(BLU_LED_PIN, 0);}
|
||||||
#define LedBluOFF() {digitalWrite(BLU_LED_PIN, 1);}
|
#define LedBluOFF() {digitalWrite(BLU_LED_PIN, 1);}
|
||||||
|
#else
|
||||||
|
#define LedBluON() {}
|
||||||
|
#define LedBluOFF() {}
|
||||||
|
#endif
|
||||||
// GPIO 12 red led
|
// GPIO 12 red led
|
||||||
#define LedRedON() {digitalWrite(RED_LED_PIN, 1);}
|
#define LedRedON() {digitalWrite(RED_LED_PIN, 1);}
|
||||||
#define LedRedOFF() {digitalWrite(RED_LED_PIN, 0);}
|
#define LedRedOFF() {digitalWrite(RED_LED_PIN, 0);}
|
||||||
|
@ -93,7 +97,7 @@ typedef struct
|
||||||
String sys_flash_speed;
|
String sys_flash_speed;
|
||||||
String sys_firmware_size;
|
String sys_firmware_size;
|
||||||
String sys_firmware_free;
|
String sys_firmware_free;
|
||||||
String sys_vcc;
|
String sys_analog;
|
||||||
String sys_eep_config;
|
String sys_eep_config;
|
||||||
} _sysinfo;
|
} _sysinfo;
|
||||||
|
|
||||||
|
|
|
@ -35,10 +35,6 @@
|
||||||
// Global project file
|
// Global project file
|
||||||
#include "ESP8266_WifInfo.h"
|
#include "ESP8266_WifInfo.h"
|
||||||
|
|
||||||
|
|
||||||
// To be able to read VCC from ESP SDK
|
|
||||||
ADC_MODE(ADC_VCC);
|
|
||||||
|
|
||||||
//WiFiManager wifi(0);
|
//WiFiManager wifi(0);
|
||||||
ESP8266WebServer server(80);
|
ESP8266WebServer server(80);
|
||||||
// Udp listener and telnet server
|
// Udp listener and telnet server
|
||||||
|
@ -73,6 +69,7 @@ Comments: -
|
||||||
void UpdateSysinfo(boolean first_call, boolean show_debug)
|
void UpdateSysinfo(boolean first_call, boolean show_debug)
|
||||||
{
|
{
|
||||||
char buff[64];
|
char buff[64];
|
||||||
|
int32_t adc;
|
||||||
int sec = seconds;
|
int sec = seconds;
|
||||||
int min = sec / 60;
|
int min = sec / 60;
|
||||||
int hr = min / 60;
|
int hr = min / 60;
|
||||||
|
@ -83,8 +80,9 @@ void UpdateSysinfo(boolean first_call, boolean show_debug)
|
||||||
sprintf( buff, "%d KB", ESP.getFreeHeap()/1024 );
|
sprintf( buff, "%d KB", ESP.getFreeHeap()/1024 );
|
||||||
sysinfo.sys_free_ram = buff;
|
sysinfo.sys_free_ram = buff;
|
||||||
|
|
||||||
sprintf( buff, "%d mV", ESP.getVcc());
|
adc = ( (1000 * analogRead(A0)) / 1024);
|
||||||
sysinfo.sys_vcc = buff;
|
sprintf( buff, "%d mV", adc);
|
||||||
|
sysinfo.sys_analog = buff;
|
||||||
|
|
||||||
// Values not subject to change during running sketch
|
// Values not subject to change during running sketch
|
||||||
if (first_call) {
|
if (first_call) {
|
||||||
|
@ -107,7 +105,7 @@ void UpdateSysinfo(boolean first_call, boolean show_debug)
|
||||||
Debug(F("Free size : ")); Debugln(sysinfo.sys_firmware_free);
|
Debug(F("Free size : ")); Debugln(sysinfo.sys_firmware_free);
|
||||||
Debug(F("Free RAM : ")); Debugln(sysinfo.sys_free_ram);
|
Debug(F("Free RAM : ")); Debugln(sysinfo.sys_free_ram);
|
||||||
Debug(F("OTA port : ")); Debugln(config.ota_port);
|
Debug(F("OTA port : ")); Debugln(config.ota_port);
|
||||||
Debug(F("VCC : ")); Debugln(sysinfo.sys_vcc);
|
Debug(F("Analog Read : ")); Debugln(sysinfo.sys_analog);
|
||||||
Debug(F("Saved Config : ")); Debugln(sysinfo.sys_eep_config);
|
Debug(F("Saved Config : ")); Debugln(sysinfo.sys_eep_config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -134,8 +132,10 @@ Comments: -
|
||||||
====================================================================== */
|
====================================================================== */
|
||||||
void LedOff(int led)
|
void LedOff(int led)
|
||||||
{
|
{
|
||||||
|
#ifdef BLU_LED_PIN
|
||||||
if (led==BLU_LED_PIN)
|
if (led==BLU_LED_PIN)
|
||||||
LedBluOFF();
|
LedBluOFF();
|
||||||
|
#endif
|
||||||
if (led==RED_LED_PIN)
|
if (led==RED_LED_PIN)
|
||||||
LedRedOFF();
|
LedRedOFF();
|
||||||
if (led==RGB_LED_PIN)
|
if (led==RGB_LED_PIN)
|
||||||
|
@ -515,12 +515,10 @@ void setup()
|
||||||
tinfo.attachNewFrame(NewFrame);
|
tinfo.attachNewFrame(NewFrame);
|
||||||
tinfo.attachUpdatedFrame(UpdatedFrame);
|
tinfo.attachUpdatedFrame(UpdatedFrame);
|
||||||
|
|
||||||
// We'll drive the on board LED (TXD1) and our on GPIO1
|
// We'll drive our onboard LED
|
||||||
// old TXD1, not used anymore, has been swapped
|
// old TXD1, not used anymore, has been swapped
|
||||||
pinMode(BLU_LED_PIN, OUTPUT);
|
|
||||||
pinMode(RED_LED_PIN, OUTPUT);
|
pinMode(RED_LED_PIN, OUTPUT);
|
||||||
LedRedOFF();
|
LedRedOFF();
|
||||||
LedBluOFF();
|
|
||||||
|
|
||||||
// start Wifi connect or soft AP
|
// start Wifi connect or soft AP
|
||||||
WifiHandleConn(true);
|
WifiHandleConn(true);
|
||||||
|
@ -581,5 +579,7 @@ void loop()
|
||||||
//Serial1.print(c);
|
//Serial1.print(c);
|
||||||
tinfo.process(c);
|
tinfo.process(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delay(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue