mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2026-02-05 00:45:37 +00:00
API CHANGE - extend http callback for drivers so it includes bPreState boolean so we can add HTML either before state div (without refresh) or in state div (refreshing)
This commit is contained in:
@ -235,6 +235,7 @@
|
||||
<ClCompile Include="src\driver\drv_ntp.c" />
|
||||
<ClCompile Include="src\driver\drv_ntp_events.c" />
|
||||
<ClCompile Include="src\driver\drv_openWeatherMap.c" />
|
||||
<ClCompile Include="src\driver\drv_pir.c" />
|
||||
<ClCompile Include="src\driver\drv_pixelAnim.c" />
|
||||
<ClCompile Include="src\driver\drv_pt6523.c" />
|
||||
<ClCompile Include="src\driver\drv_pwmToggler.c" />
|
||||
@ -1287,4 +1288,4 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@ -394,6 +394,7 @@
|
||||
<ClCompile Include="libraries\berry\src\be_var.c" />
|
||||
<ClCompile Include="libraries\berry\src\be_vector.c" />
|
||||
<ClCompile Include="libraries\berry\src\be_vm.c" />
|
||||
<ClCompile Include="src\driver\drv_pir.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\base64\base64.h" />
|
||||
@ -637,4 +638,4 @@
|
||||
<CustomBuild Include="src\rgb2hsv.h" />
|
||||
<CustomBuild Include="..\..\platforms\bk7231t\bk7231t_os\application.mk" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@ -230,7 +230,7 @@ void AHT2X_OnEverySecond()
|
||||
}
|
||||
}
|
||||
|
||||
void AHT2X_AppendInformationToHTTPIndexPage(http_request_t* request)
|
||||
void AHT2X_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState)
|
||||
{
|
||||
hprintf255(request, "<h2>AHT2X Temperature=%.1fC, Humidity=%.0f%%</h2>", g_temp, g_humid);
|
||||
if(!isWorking)
|
||||
|
||||
@ -180,8 +180,11 @@ void Batt_OnEverySecond() {
|
||||
void Batt_StopDriver() {
|
||||
|
||||
}
|
||||
void Batt_AppendInformationToHTTPIndexPage(http_request_t* request)
|
||||
void Batt_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState)
|
||||
{
|
||||
if (bPreState) {
|
||||
return;
|
||||
}
|
||||
hprintf255(request, "<h2>Battery level=%.2f%%, voltage=%.2fmV</h2>", g_battlevel, g_battvoltage);
|
||||
}
|
||||
|
||||
|
||||
@ -135,8 +135,10 @@ void BL09XX_AppendInformationToHTTPIndexPageEx(int asensdatasetix, http_request_
|
||||
{
|
||||
if ((asensdatasetix < 0) || (asensdatasetix >= BL_SENSDATASETS_COUNT)) return; //to avoid bad index on data[BL_SENSDATASETS_COUNT]
|
||||
#else
|
||||
void BL09XX_AppendInformationToHTTPIndexPage(http_request_t * request)
|
||||
void BL09XX_AppendInformationToHTTPIndexPage(http_request_t * request, int bPreState)
|
||||
{
|
||||
if (bPreState)
|
||||
return;
|
||||
int asensdatasetix = BL_SENSORS_IX_0;
|
||||
#endif
|
||||
energysensdataset_t* sensdataset = &datasetlist[asensdatasetix];
|
||||
@ -253,7 +255,9 @@ void BL09XX_AppendInformationToHTTPIndexPage(http_request_t * request)
|
||||
}
|
||||
|
||||
#if ENABLE_BL_TWIN
|
||||
void BL09XX_AppendInformationToHTTPIndexPage(http_request_t* request) {
|
||||
void BL09XX_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState) {
|
||||
if (bPreState)
|
||||
return;
|
||||
if (sensors_reciveddata[BL_SENSORS_IX_0]) {
|
||||
BL09XX_AppendInformationToHTTPIndexPageEx(BL_SENSORS_IX_0, request);
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
void BL_Shared_Init(void);
|
||||
void BL_ProcessUpdate(float voltage, float current, float power,
|
||||
float frequency, float energyWh);
|
||||
void BL09XX_AppendInformationToHTTPIndexPage(http_request_t *request);
|
||||
void BL09XX_AppendInformationToHTTPIndexPage(http_request_t *request, int bPreState);
|
||||
void BL09XX_SaveEmeteringStatistics();
|
||||
|
||||
#define BL_SENSORS_IX_0 0
|
||||
|
||||
@ -191,8 +191,10 @@ void BMPI2C_OnEverySecond()
|
||||
}
|
||||
}
|
||||
|
||||
void BMPI2C_AppendInformationToHTTPIndexPage(http_request_t* request)
|
||||
void BMPI2C_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState)
|
||||
{
|
||||
if (bPreState)
|
||||
return;
|
||||
hprintf255(request, "<h2>%s Temperature=%.2f C, Pressure=%.2f hPa", g_chipName, g_temperature * 0.01f, g_pressure * 0.01f);
|
||||
if(isHumidityAvail)
|
||||
{
|
||||
|
||||
@ -91,8 +91,10 @@ void ChargingLimit_OnEverySecond() {
|
||||
}
|
||||
}
|
||||
|
||||
void ChargingLimit_AppendInformationToHTTPIndexPage(http_request_t* request)
|
||||
void ChargingLimit_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState)
|
||||
{
|
||||
if (bPreState)
|
||||
return;
|
||||
const char *rStr;
|
||||
int type;
|
||||
|
||||
|
||||
@ -509,8 +509,10 @@ void Chart_Display(http_request_t *request, chart_t *s) {
|
||||
poststr(request, "<style onload='cha();'></style>");
|
||||
|
||||
}
|
||||
void DRV_Charts_AddToHtmlPage_Test(http_request_t *request) {
|
||||
|
||||
void DRV_Charts_AddToHtmlPage_Test(http_request_t *request, int bPreState) {
|
||||
if (bPreState) {
|
||||
return;
|
||||
}
|
||||
// chart_create [NumSamples] [NumVariables] [NumAxes]
|
||||
// chart_create 16 3 2
|
||||
chart_t *s = Chart_Create(16, 3, 2);
|
||||
@ -557,11 +559,9 @@ void DRV_Charts_AddToHtmlPage_Test(http_request_t *request) {
|
||||
Chart_Free(&s);
|
||||
}
|
||||
// startDriver Charts
|
||||
void DRV_Charts_AddToHtmlPage(http_request_t *request) {
|
||||
if (0) {
|
||||
DRV_Charts_AddToHtmlPage_Test(request);
|
||||
void DRV_Charts_AddToHtmlPage(http_request_t *request, int bPreState) {
|
||||
if (bPreState)
|
||||
return;
|
||||
}
|
||||
if (g_chart) {
|
||||
Chart_Display(request, g_chart);
|
||||
}
|
||||
|
||||
@ -315,8 +315,10 @@ void CHT83XX_OnEverySecond()
|
||||
}
|
||||
}
|
||||
|
||||
void CHT83XX_AppendInformationToHTTPIndexPage(http_request_t* request)
|
||||
void CHT83XX_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState)
|
||||
{
|
||||
if (bPreState)
|
||||
return;
|
||||
hprintf255(request, "<h2>%s Temperature=%f, Humidity=%f</h2>", g_cht_sensor, g_temp, g_humid);
|
||||
if(channel_humid == channel_temp)
|
||||
{
|
||||
|
||||
@ -103,7 +103,9 @@ void DRV_HUE_Send_Advert_To(struct sockaddr_in *addr) {
|
||||
}
|
||||
|
||||
|
||||
void HUE_AppendInformationToHTTPIndexPage(http_request_t* request) {
|
||||
void HUE_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState) {
|
||||
if(bPreState)
|
||||
return;
|
||||
hprintf255(request, "<h4>HUE: searches %i, setup %i, events %i, mService %i, event %i </h4>",
|
||||
stat_searchesReceived, stat_setupXMLVisits, stat_eventsReceived, stat_metaServiceXMLVisits, stat_eventServiceXMLVisits);
|
||||
|
||||
|
||||
@ -84,23 +84,22 @@ void DGR_SpoofNextDGRPacketSource(const char* ipStrs);
|
||||
void TuyaMCU_Sensor_RunEverySecond();
|
||||
void TuyaMCU_Sensor_Init();
|
||||
|
||||
void DRV_Test_Charts_AddToHtmlPage(http_request_t *request);
|
||||
void DRV_Test_Charts_AddToHtmlPage(http_request_t *request, int bPreState);
|
||||
|
||||
void DRV_Charts_AddToHtmlPage(http_request_t *request);
|
||||
void DRV_Charts_AddToHtmlPage(http_request_t *request, int bPreState);
|
||||
void DRV_Charts_Init();
|
||||
|
||||
void DRV_Toggler_ProcessChanges(http_request_t* request);
|
||||
void DRV_Toggler_AddToHtmlPage(http_request_t* request);
|
||||
void DRV_Toggler_AppendInformationToHTTPIndexPage(http_request_t* request);
|
||||
void DRV_Toggler_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState);
|
||||
void DRV_Toggler_QuickTick();
|
||||
void DRV_InitPWMToggler();
|
||||
|
||||
void DRV_Widget_AddToHtmlPage(http_request_t *request);
|
||||
void DRV_Widget_BeforeState(http_request_t* request);
|
||||
void DRV_Widget_AddToHtmlPage(http_request_t *request, int bPreState);
|
||||
void DRV_Widget_Init();
|
||||
|
||||
void DRV_OpenWeatherMap_Init();
|
||||
void OWM_AppendInformationToHTTPIndexPage(http_request_t *request);
|
||||
void OWM_AppendInformationToHTTPIndexPage(http_request_t *request, int bPreState);
|
||||
|
||||
void DRV_HTTPButtons_ProcessChanges(http_request_t* request);
|
||||
void DRV_HTTPButtons_AddToHtmlPage(http_request_t* request);
|
||||
@ -108,36 +107,42 @@ void DRV_InitHTTPButtons();
|
||||
|
||||
void CHT83XX_Init();
|
||||
void CHT83XX_OnEverySecond();
|
||||
void CHT83XX_AppendInformationToHTTPIndexPage(http_request_t* request);
|
||||
void CHT83XX_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState);
|
||||
|
||||
void SHT3X_Init();
|
||||
void SHT3X_AppendInformationToHTTPIndexPage(http_request_t* request);
|
||||
void SHT3X_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState);
|
||||
void SHT3X_OnEverySecond();
|
||||
void SHT3X_StopDriver();
|
||||
|
||||
void AHT2X_Init();
|
||||
void AHT2X_AppendInformationToHTTPIndexPage(http_request_t* request);
|
||||
void AHT2X_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState);
|
||||
void AHT2X_OnEverySecond();
|
||||
void AHT2X_StopDriver();
|
||||
|
||||
void BMPI2C_Init();
|
||||
void BMPI2C_AppendInformationToHTTPIndexPage(http_request_t* request);
|
||||
void BMPI2C_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState);
|
||||
void BMPI2C_OnEverySecond();
|
||||
|
||||
void SGP_Init();
|
||||
void SGP_AppendInformationToHTTPIndexPage(http_request_t* request);
|
||||
void SGP_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState);
|
||||
void SGP_OnEverySecond();
|
||||
void SGP_StopDriver();
|
||||
|
||||
void Batt_Init();
|
||||
void Batt_OnEverySecond();
|
||||
void Batt_AppendInformationToHTTPIndexPage(http_request_t* request);
|
||||
void Batt_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState);
|
||||
void Batt_StopDriver();
|
||||
|
||||
void Shift_Init();
|
||||
void Shift_OnEverySecond();
|
||||
void Shift_OnChannelChanged(int ch, int value);
|
||||
|
||||
void PIR_Init();
|
||||
void PIR_OnEverySecond();
|
||||
void PIR_OnChannelChanged(int ch, int value);
|
||||
void PIR_AppendInformationToHTTPIndexPage(http_request_t *request, int bPreState);
|
||||
|
||||
|
||||
void TMGN_RunQuickTick();
|
||||
|
||||
void DRV_MAX72XX_Init();
|
||||
@ -145,18 +150,18 @@ void DRV_MAX72XX_Init();
|
||||
void apply_smart_light();
|
||||
|
||||
void WEMO_Init();
|
||||
void WEMO_AppendInformationToHTTPIndexPage(http_request_t* request);
|
||||
void WEMO_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState);
|
||||
|
||||
void HUE_Init();
|
||||
void HUE_AppendInformationToHTTPIndexPage(http_request_t* request);
|
||||
void HUE_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState);
|
||||
|
||||
void MCP9808_Init();
|
||||
void MCP9808_OnEverySecond();
|
||||
void MCP9808_AppendInformationToHTTPIndexPage(http_request_t* request);
|
||||
void MCP9808_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState);
|
||||
|
||||
void ChargingLimit_Init();
|
||||
void ChargingLimit_OnEverySecond();
|
||||
void ChargingLimit_AppendInformationToHTTPIndexPage(http_request_t *request);
|
||||
void ChargingLimit_AppendInformationToHTTPIndexPage(http_request_t *request, int bPreState);
|
||||
|
||||
void RN8209_Init(void);
|
||||
void RN8029_RunEverySecond(void);
|
||||
|
||||
@ -19,7 +19,7 @@ typedef struct driver_s {
|
||||
const char* name;
|
||||
void(*initFunc)();
|
||||
void(*onEverySecond)();
|
||||
void(*appendInformationToHTTPIndexPage)(http_request_t* request);
|
||||
void(*appendInformationToHTTPIndexPage)(http_request_t* request, int bPreState);
|
||||
void(*runQuickTick)();
|
||||
void(*stopFunc)();
|
||||
void(*onChannelChanged)(int ch, int val);
|
||||
@ -50,6 +50,13 @@ static driver_t g_drivers[] = {
|
||||
//drvdetail:"requires":""}
|
||||
{ "Freeze", Freeze_Init, Freeze_OnEverySecond, NULL, Freeze_RunFrame, NULL, NULL, false },
|
||||
#endif
|
||||
#if ENABLE_DRIVER_PIR
|
||||
//drvdetail:{"name":"PIR",
|
||||
//drvdetail:"title":"TODO",
|
||||
//drvdetail:"descr":"PIR",
|
||||
//drvdetail:"requires":""}
|
||||
{ "PIR", PIR_Init, PIR_OnEverySecond, PIR_AppendInformationToHTTPIndexPage, NULL, NULL, PIR_OnChannelChanged, false },
|
||||
#endif
|
||||
#if ENABLE_DRIVER_PIXELANIM
|
||||
//drvdetail:{"name":"PixelAnim",
|
||||
//drvdetail:"title":"TODO",
|
||||
@ -655,7 +662,7 @@ void DRV_Generic_Init() {
|
||||
//cmddetail:"examples":""}
|
||||
CMD_RegisterCommand("stopDriver", DRV_Stop, NULL);
|
||||
}
|
||||
void DRV_AppendInformationToHTTPIndexPage(http_request_t* request) {
|
||||
void DRV_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState) {
|
||||
int i, j;
|
||||
int c_active = 0;
|
||||
|
||||
@ -666,31 +673,33 @@ void DRV_AppendInformationToHTTPIndexPage(http_request_t* request) {
|
||||
if (g_drivers[i].bLoaded) {
|
||||
c_active++;
|
||||
if (g_drivers[i].appendInformationToHTTPIndexPage) {
|
||||
g_drivers[i].appendInformationToHTTPIndexPage(request);
|
||||
g_drivers[i].appendInformationToHTTPIndexPage(request, bPreState);
|
||||
}
|
||||
}
|
||||
}
|
||||
DRV_Mutex_Free();
|
||||
|
||||
hprintf255(request, "<h5>%i drivers active", c_active);
|
||||
if (c_active > 0) {
|
||||
j = 0;// printed 0 names so far
|
||||
// generate active drivers list in ( )
|
||||
hprintf255(request, " (");
|
||||
for (i = 0; i < g_numDrivers; i++) {
|
||||
if (g_drivers[i].bLoaded) {
|
||||
// if at least one name printed, add separator
|
||||
if (j != 0) {
|
||||
hprintf255(request, ",");
|
||||
if (bPreState == false) {
|
||||
hprintf255(request, "<h5>%i drivers active", c_active);
|
||||
if (c_active > 0) {
|
||||
j = 0;// printed 0 names so far
|
||||
// generate active drivers list in ( )
|
||||
hprintf255(request, " (");
|
||||
for (i = 0; i < g_numDrivers; i++) {
|
||||
if (g_drivers[i].bLoaded) {
|
||||
// if at least one name printed, add separator
|
||||
if (j != 0) {
|
||||
hprintf255(request, ",");
|
||||
}
|
||||
hprintf255(request, g_drivers[i].name);
|
||||
// one more name printed
|
||||
j++;
|
||||
}
|
||||
hprintf255(request, g_drivers[i].name);
|
||||
// one more name printed
|
||||
j++;
|
||||
}
|
||||
hprintf255(request, ")");
|
||||
}
|
||||
hprintf255(request, ")");
|
||||
hprintf255(request, ", total %i</h5>", g_numDrivers);
|
||||
}
|
||||
hprintf255(request, ", total %i</h5>", g_numDrivers);
|
||||
}
|
||||
|
||||
bool DRV_IsMeasuringPower() {
|
||||
|
||||
@ -288,8 +288,10 @@ void MCP9808_OnEverySecond() {
|
||||
}
|
||||
}
|
||||
|
||||
void MCP9808_AppendInformationToHTTPIndexPage(http_request_t* request)
|
||||
void MCP9808_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState)
|
||||
{
|
||||
if (bPreState)
|
||||
return;
|
||||
hprintf255(request, "<h2>MCP9808 Temperature=%f</h2>", g_temp);
|
||||
}
|
||||
|
||||
|
||||
@ -747,8 +747,10 @@ void NTP_OnEverySecond()
|
||||
}
|
||||
}
|
||||
|
||||
void NTP_AppendInformationToHTTPIndexPage(http_request_t* request)
|
||||
void NTP_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState)
|
||||
{
|
||||
if (bPreState)
|
||||
return;
|
||||
struct tm *ltm;
|
||||
|
||||
ltm = gmtime(&g_ntpTime);
|
||||
|
||||
@ -8,7 +8,7 @@ void NTP_OnEverySecond();
|
||||
// returns number of seconds passed after 1900
|
||||
unsigned int NTP_GetCurrentTime();
|
||||
unsigned int NTP_GetCurrentTimeWithoutOffset();
|
||||
void NTP_AppendInformationToHTTPIndexPage(http_request_t* request);
|
||||
void NTP_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState);
|
||||
bool NTP_IsTimeSynced();
|
||||
int NTP_GetTimesZoneOfsSeconds();
|
||||
int NTP_GetWeekDay();
|
||||
|
||||
@ -234,8 +234,10 @@ static commandResult_t CMD_OWM_Setup(const void *context, const char *cmd, const
|
||||
|
||||
return CMD_RES_OK;
|
||||
}
|
||||
void OWM_AppendInformationToHTTPIndexPage(http_request_t *request) {
|
||||
|
||||
void OWM_AppendInformationToHTTPIndexPage(http_request_t *request, int bPreState) {
|
||||
if (bPreState) {
|
||||
return;
|
||||
}
|
||||
hprintf255(request, "<h4>OpenWeatherMap Integration</h4>");
|
||||
if (1) {
|
||||
hprintf255(request, "<h6>Raw Reply (only in DEBUG)</h6>");
|
||||
|
||||
48
src/driver/drv_pir.c
Normal file
48
src/driver/drv_pir.c
Normal file
@ -0,0 +1,48 @@
|
||||
#include "../new_common.h"
|
||||
#include "../new_pins.h"
|
||||
#include "../new_cfg.h"
|
||||
// Commands register, execution API and cmd tokenizer
|
||||
#include "../cmnds/cmd_public.h"
|
||||
#include "../mqtt/new_mqtt.h"
|
||||
#include "../logging/logging.h"
|
||||
#include "drv_local.h"
|
||||
#include "../hal/hal_pins.h"
|
||||
|
||||
int g_onTime;
|
||||
|
||||
void PIR_Init() {
|
||||
|
||||
}
|
||||
|
||||
void PIR_OnEverySecond() {
|
||||
|
||||
}
|
||||
|
||||
void PIR_OnChannelChanged(int ch, int value) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
void PIR_AppendInformationToHTTPIndexPage(http_request_t *request, int bPreState) {
|
||||
if (bPreState)
|
||||
{
|
||||
char tmpA[32];
|
||||
if (http_getArg(request->url, "pirTime", tmpA, sizeof(tmpA))) {
|
||||
g_onTime = atoi(tmpA);
|
||||
}
|
||||
|
||||
hprintf255(request, "<h3>PIR Sensor Settings</h3>");
|
||||
hprintf255(request, "<form action=\"index\" method=\"get\">");
|
||||
hprintf255(request, "On Time (seconds): <input type=\"text\" name=\"pirTime\" value=\"%i\"/>", g_onTime);
|
||||
hprintf255(request, "<input type=\"submit\" value=\"Save\"/>");
|
||||
hprintf255(request, "</form>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ typedef struct energySensorNames_s {
|
||||
extern int g_dhtsCount;
|
||||
|
||||
void DRV_Generic_Init();
|
||||
void DRV_AppendInformationToHTTPIndexPage(http_request_t* request);
|
||||
void DRV_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState);
|
||||
void DRV_OnEverySecond();
|
||||
void DHT_OnEverySecond();
|
||||
void DHT_OnPinsConfigChanged();
|
||||
|
||||
@ -355,7 +355,9 @@ void DRV_Toggler_QuickTick() {
|
||||
}
|
||||
}
|
||||
}
|
||||
void DRV_Toggler_AppendInformationToHTTPIndexPage(http_request_t* request) {
|
||||
void DRV_Toggler_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState) {
|
||||
if (bPreState)
|
||||
return;
|
||||
int i;
|
||||
hprintf255(request, "<h4>Toggler: ");
|
||||
int cnt = 0;
|
||||
|
||||
@ -253,8 +253,10 @@ void SGP_OnEverySecond()
|
||||
ADDLOG_DEBUG(LOG_FEATURE_DRV, "DRV_SGP : Measurement will run in %i cycle", g_sgpcycle);
|
||||
}
|
||||
|
||||
void SGP_AppendInformationToHTTPIndexPage(http_request_t* request)
|
||||
void SGP_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState)
|
||||
{
|
||||
if(bPreState)
|
||||
return;
|
||||
|
||||
hprintf255(request, "<h2>SGP CO2=%.1f ppm, TVoc=%.0f ppb</h2>", g_co2, g_tvoc);
|
||||
if (channel_co2 == channel_tvoc) {
|
||||
|
||||
@ -517,8 +517,10 @@ void SHT3X_OnEverySecond()
|
||||
}
|
||||
}
|
||||
|
||||
void SHT3X_AppendInformationToHTTPIndexPage(http_request_t* request)
|
||||
void SHT3X_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState)
|
||||
{
|
||||
if(bPreState)
|
||||
return;
|
||||
hprintf255(request, "<h2>SHT3X Temperature=%.1fC, Humidity=%.0f%%</h2>", g_temp, g_humid);
|
||||
if (channel_humid == channel_temp) {
|
||||
hprintf255(request, "WARNING: You don't have configured target channels for temp and humid results, set the first and second channel index in Pins!");
|
||||
|
||||
@ -9,7 +9,11 @@
|
||||
#include "../httpserver/new_http.h"
|
||||
|
||||
// startDriver TestCharts
|
||||
void DRV_Test_Charts_AddToHtmlPage(http_request_t *request) {
|
||||
void DRV_Test_Charts_AddToHtmlPage(http_request_t *request, int bPreState) {
|
||||
if (bPreState) {
|
||||
return;
|
||||
}
|
||||
|
||||
time_t timeStamps[16];
|
||||
float temperature[16];
|
||||
float humidity[16];
|
||||
|
||||
@ -191,7 +191,9 @@ void DRV_WEMO_Send_Advert_To(int mode, struct sockaddr_in *addr) {
|
||||
DRV_SSDP_SendReply(addr, buffer_out);
|
||||
}
|
||||
|
||||
void WEMO_AppendInformationToHTTPIndexPage(http_request_t* request) {
|
||||
void WEMO_AppendInformationToHTTPIndexPage(http_request_t* request, int bPreState) {
|
||||
if(bPreState)
|
||||
return;
|
||||
hprintf255(request, "<h4>WEMO: searches %i, setup %i, events %i, mService %i, event %i </h4>",
|
||||
stat_searchesReceived, stat_setupXMLVisits, stat_eventsReceived, stat_metaServiceXMLVisits, stat_eventServiceXMLVisits);
|
||||
|
||||
|
||||
@ -68,12 +68,14 @@ void DRV_Widget_DisplayList(http_request_t* request, WidgetLocation loc) {
|
||||
w = w->next;
|
||||
}
|
||||
}
|
||||
void DRV_Widget_BeforeState(http_request_t* request) {
|
||||
DRV_Widget_DisplayList(request, WIDGET_STATIC);
|
||||
}
|
||||
|
||||
void DRV_Widget_AddToHtmlPage(http_request_t *request) {
|
||||
DRV_Widget_DisplayList(request, WIDGET_STATE);
|
||||
void DRV_Widget_AddToHtmlPage(http_request_t *request, int bPreState) {
|
||||
if (bPreState) {
|
||||
DRV_Widget_DisplayList(request, WIDGET_STATIC);
|
||||
}
|
||||
else {
|
||||
DRV_Widget_DisplayList(request, WIDGET_STATE);
|
||||
}
|
||||
}
|
||||
void Widget_Add(widget_t **first, widget_t *n) {
|
||||
if (*first == 0) {
|
||||
|
||||
@ -340,16 +340,14 @@ int http_fn_index(http_request_t* request) {
|
||||
poststr(request, "</div>"); // end div#change
|
||||
|
||||
|
||||
#if defined(ENABLE_DRIVER_WIDGET)
|
||||
if (DRV_IsRunning("Widget")) {
|
||||
DRV_Widget_BeforeState(request);
|
||||
}
|
||||
#endif
|
||||
#if ENABLE_OBK_BERRY
|
||||
void Berry_SaveRequest(http_request_t *r);
|
||||
Berry_SaveRequest(request);
|
||||
CMD_Berry_RunEventHandlers_StrInt(CMD_EVENT_ON_HTTP, "prestate", (int)request);
|
||||
#endif
|
||||
#ifndef OBK_DISABLE_ALL_DRIVERS
|
||||
DRV_AppendInformationToHTTPIndexPage(request, true);
|
||||
#endif
|
||||
|
||||
poststr(request, "<div id=\"state\">"); // replaceable content follows
|
||||
}
|
||||
@ -770,7 +768,7 @@ int http_fn_index(http_request_t* request) {
|
||||
|
||||
poststr(request, "</table>");
|
||||
#ifndef OBK_DISABLE_ALL_DRIVERS
|
||||
DRV_AppendInformationToHTTPIndexPage(request);
|
||||
DRV_AppendInformationToHTTPIndexPage(request, false);
|
||||
#endif
|
||||
|
||||
if (1) {
|
||||
|
||||
@ -80,6 +80,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#define ENABLE_DRIVER_PIR 1
|
||||
#define ENABLE_HA_DISCOVERY 1
|
||||
#define ENABLE_SEND_POSTANDGET 1
|
||||
#define ENABLE_MQTT 1
|
||||
|
||||
Reference in New Issue
Block a user