mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 04:06:29 +01:00
ota improvements
This commit is contained in:
8
.github/workflows/release.yml
vendored
8
.github/workflows/release.yml
vendored
@@ -54,7 +54,7 @@ jobs:
|
||||
- name: Build firmware for ESP32
|
||||
run: |
|
||||
cd ESP32_AP-Flasher
|
||||
export PLATFORMIO_BUILD_FLAGS="-D BUILD_VERSION=${{ github.ref }} -D SHA=$GITHUB_SHA"
|
||||
export PLATFORMIO_BUILD_FLAGS="-D BUILD_VERSION=${{ github.ref_name }} -D SHA=$GITHUB_SHA"
|
||||
pio run --environment Simple_AP
|
||||
mkdir /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32fw
|
||||
cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32fw/boot_app0.bin
|
||||
@@ -76,7 +76,7 @@ jobs:
|
||||
- name: Build firmware for ESP32-S2
|
||||
run: |
|
||||
cd ESP32_AP-Flasher
|
||||
export PLATFORMIO_BUILD_FLAGS="-D BUILD_VERSION=${{ github.ref }} -D SHA=$GITHUB_SHA"
|
||||
export PLATFORMIO_BUILD_FLAGS="-D BUILD_VERSION=${{ github.ref_name }} -D SHA=$GITHUB_SHA"
|
||||
pio run --environment OpenEPaperLink_Mini_AP
|
||||
mkdir /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32s2fw
|
||||
cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32s2fw/boot_app0.bin
|
||||
@@ -98,7 +98,7 @@ jobs:
|
||||
- name: Build firmware for ESP32-S3
|
||||
run: |
|
||||
cd ESP32_AP-Flasher
|
||||
export PLATFORMIO_BUILD_FLAGS="-D BUILD_VERSION=${{ github.ref }} -D SHA=$GITHUB_SHA"
|
||||
export PLATFORMIO_BUILD_FLAGS="-D BUILD_VERSION=${{ github.ref_name }} -D SHA=$GITHUB_SHA"
|
||||
pio run --environment OpenEPaperLink_AP_and_Flasher
|
||||
mkdir /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32s3fw
|
||||
cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin /home/runner/work/OpenEPaperLink/OpenEPaperLink/esp32s3fw/boot_app0.bin
|
||||
@@ -129,7 +129,7 @@ jobs:
|
||||
|
||||
- name: generate release json file
|
||||
run: |
|
||||
python genfilelist.py ${{ github.ref }} $GITHUB_REPOSITORY $GITHUB_SHA
|
||||
python genfilelist.py ${{ github.ref_name }} $GITHUB_REPOSITORY $GITHUB_SHA
|
||||
|
||||
- name: Add file list to release
|
||||
uses: svenstaro/upload-release-action@v2
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
To use Google Apps Script to get all events for the next day and return them via JSON in a web app, you can follow these steps:
|
||||
|
||||
Create a new Google Apps Script project by going to https://script.google.com and clicking on "New project".
|
||||
|
||||
In the script editor, create a new function called "getEventsForNextDay" that will fetch all events for the next day and return them in JSON format:
|
||||
|
||||
function getEventsForNextDay() {
|
||||
var start = new Date();
|
||||
var end = new Date();
|
||||
end.setDate(end.getDate() + 1);
|
||||
var calendars = CalendarApp.getAllCalendars();
|
||||
var events = [];
|
||||
for (var i = 0; i < calendars.length; i++) {
|
||||
var calendar = calendars[i];
|
||||
var eventsInCalendar = calendar.getEvents(start, end);
|
||||
for (var j = 0; j < eventsInCalendar.length; j++) {
|
||||
var event = eventsInCalendar[j];
|
||||
events.push({
|
||||
title: event.getTitle(),
|
||||
start: Math.floor(event.getStartTime().getTime() / 1000),
|
||||
end: Math.floor(event.getEndTime().getTime() / 1000),
|
||||
location: event.getLocation(),
|
||||
description: event.getDescription()
|
||||
});
|
||||
}
|
||||
}
|
||||
// Sort events by start date/time
|
||||
events.sort(function(a, b) {
|
||||
return a.start - b.start;
|
||||
});
|
||||
return JSON.stringify(events);
|
||||
}
|
||||
|
||||
function doGet() {
|
||||
var content = getEventsForNextDay();
|
||||
var output = ContentService.createTextOutput(content);
|
||||
output.setMimeType(ContentService.MimeType.JSON);
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
This function calls the getEventsForNextDay() function to get the events in JSON format, creates a text output with the JSON content, sets the MIME type to JSON, and returns the output.
|
||||
|
||||
Deploy the web app by clicking on "Deploy > New Deployment" in the script editor. Choose "Web app" as the deployment type, set the access to "Anyone, even anonymous", and click on "Deploy". Make sure to take note of the web app URL generated by Google.
|
||||
|
||||
Test the web app by visiting the web app URL in a web browser. You should see the events for the next day in JSON format.
|
||||
@@ -1,5 +1,10 @@
|
||||
import requests
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
mac = "00000197E5CB3B38" # destination mac address
|
||||
dither = 0 # set dither to 1 is you're sending photos etc
|
||||
apip = "192.168.178.192" # ip address of your access point
|
||||
|
||||
# Create a new paletted image with indexed colors
|
||||
image = Image.new('P', (296, 128))
|
||||
|
||||
@@ -40,4 +45,20 @@ draw.text(text_position_line2, line2, fill=1, font=font_line2) # Use palette in
|
||||
rgb_image = image.convert('RGB')
|
||||
|
||||
# Save the image as JPEG with maximum quality
|
||||
rgb_image.save('output.jpg', 'JPEG', quality="maximum")
|
||||
image_path = 'output.jpg'
|
||||
rgb_image.save(image_path, 'JPEG', quality="maximum")
|
||||
|
||||
# Prepare the HTTP POST request
|
||||
url = "http://" + apip + "/imgupload"
|
||||
payload = {"dither": dither, "mac": mac} # Additional POST parameter
|
||||
files = {"file": open(image_path, "rb")} # File to be uploaded
|
||||
|
||||
# Send the HTTP POST request
|
||||
response = requests.post(url, data=payload, files=files)
|
||||
|
||||
# Check the response status
|
||||
if response.status_code == 200:
|
||||
print("Image uploaded successfully!")
|
||||
else:
|
||||
print("Failed to upload the image.")
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ export function initUpdate() {
|
||||
|
||||
releaseDetails.forEach(release => {
|
||||
const tableRow = document.createElement('tr');
|
||||
tableRow.innerHTML = `<td><a href="${release.html_url}" target="_new">${release.tag_name}</a></td><td>${release.date}</td><td>${release.name}</td><td>${release.author}</td><td><button onclick="otamodule.updateESP('${release.file_url}')">MCU</button></td><td><button onclick="otamodule.updateWebpage('${release.file_url}')">Filesystem</button></td>`;
|
||||
tableRow.innerHTML = `<td><a href="${release.html_url}" target="_new">${release.tag_name}</a></td><td>${release.date}</td><td>${release.name}</td><td>${release.author}</td><td><button onclick="otamodule.updateESP('${release.file_url}')">ESP32</button></td><td><button onclick="otamodule.updateWebpage('${release.file_url}')">Filesystem</button></td>`;
|
||||
table.appendChild(tableRow);
|
||||
});
|
||||
|
||||
@@ -137,10 +137,14 @@ export function updateWebpage(fileUrl) {
|
||||
print(`Finished updating with ${errors} errors.`, "red");
|
||||
} else {
|
||||
print("------", "gray");
|
||||
print("Update succesfull.");
|
||||
print("Update succesful, reload now.");
|
||||
}
|
||||
disableButtons(false);
|
||||
|
||||
const newLine = document.createElement('div');
|
||||
newLine.innerHTML = "<button onclick=\"window.reload()\">Reload this page</button>";
|
||||
consoleDiv.appendChild(newLine);
|
||||
consoleDiv.scrollTop = consoleDiv.scrollHeight;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -228,7 +232,11 @@ export function print(line, color = "white") {
|
||||
const isScrolledToBottom = consoleDiv.scrollHeight - consoleDiv.clientHeight <= consoleDiv.scrollTop;
|
||||
const newLine = document.createElement('div');
|
||||
newLine.style.color = color;
|
||||
newLine.textContent = line;
|
||||
if (line == "[reboot]") {
|
||||
newLine.innerHTML = "<button onclick=\"fetch(\"/reboot\",{method: \"POST\"}); \">Reboot</button>";
|
||||
} else {
|
||||
newLine.textContent = line;
|
||||
}
|
||||
consoleDiv.appendChild(newLine);
|
||||
if (isScrolledToBottom) {
|
||||
consoleDiv.scrollTop = consoleDiv.scrollHeight;
|
||||
|
||||
@@ -202,7 +202,8 @@ void updateFirmware(const char* url, const char* expectedMd5, size_t size) {
|
||||
if (written == httpClient.getSize()) {
|
||||
if (Update.end(true)) {
|
||||
wsSerial("Firmware update successful");
|
||||
wsSerial("Restarting system...");
|
||||
wsSerial("Reboot system now");
|
||||
wsSerial("[reboot]");
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
ESP.restart();
|
||||
} else {
|
||||
@@ -228,8 +229,8 @@ void handleRollback(AsyncWebServerRequest* request) {
|
||||
if (Update.canRollBack()) {
|
||||
bool rollbackSuccess = Update.rollBack();
|
||||
if (rollbackSuccess) {
|
||||
request->send(200, "Rollback successfull");
|
||||
wsSerial("Rollback successfull");
|
||||
request->send(200, "Rollback successful");
|
||||
wsSerial("Rollback successful");
|
||||
wsSerial("Restarting system...");
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
ESP.restart();
|
||||
|
||||
@@ -50,7 +50,6 @@ rp = os.getcwd()
|
||||
now = datetime.now()
|
||||
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
|
||||
tag = sys.argv[1]
|
||||
tag = tag[10:]
|
||||
|
||||
binaries = generate_file_hashes2(rp + "/espbinaries",tag)
|
||||
tagota = generate_file_hashes2(rp + "/binaries",tag)
|
||||
|
||||
Reference in New Issue
Block a user