1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-16 07:23:07 +01:00

Added screenshot feature

This commit is contained in:
2024-12-22 14:07:18 +01:00
parent 2a19a2e615
commit 21ae96c8d7
7 changed files with 81 additions and 18 deletions

View File

@@ -183,13 +183,6 @@ class PageList{
}
};
class PageStruct{
public:
Page *page=NULL;
PageData parameters;
PageDescription *description=NULL;
};
/**
* this function will add all the pages we know to the pagelist
* each page should have defined a registerXXXPage variable of type
@@ -353,6 +346,10 @@ void OBP60Task(GwApi *api){
// Init pages
int numPages=1;
PageStruct pages[MAX_PAGE_NUMBER];
// Set start page
int pageNumber = int(api->getConfig()->getConfigItem(api->getConfig()->startPage,true)->asInt()) - 1;
int lastPage=pageNumber;
BoatValueList boatValues; //all the boat values for the api query
//commonData.distanceformat=config->getString(xxx);
//add all necessary data to common data
@@ -395,6 +392,11 @@ void OBP60Task(GwApi *api){
pages[i].parameters.values.push_back(value);
}
}
api->registerRequestHandler("screenshot", [api, &pageNumber, pages](AsyncWebServerRequest *request) {
doImageRequest(api, &pageNumber, pages, request);
});
//now we have prepared the page data
//we start a separate task that will fetch our keys...
MyData allParameters;
@@ -431,9 +433,6 @@ void OBP60Task(GwApi *api){
GwApi::BoatValue *hdop = boatValues.findValueOrCreate("HDOP"); // Load GpsHDOP
LOG_DEBUG(GwLog::LOG,"obp60task: start mainloop");
// Set start page
int pageNumber = int(api->getConfig()->getConfigItem(api->getConfig()->startPage,true)->asInt()) - 1;
int lastPage=pageNumber;
commonData.time = boatValues.findValueOrCreate("GPST"); // Load GpsTime
commonData.date = boatValues.findValueOrCreate("GPSD"); // Load GpsTime