Compare commits
	
		
			17 Commits
		
	
	
		
			v1.0.6
			...
			3cd0798186
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3cd0798186 | |||
| 2a67d8f67c | |||
| 240795a2d0 | |||
| 4e384d777e | |||
| 03cbf82275 | |||
| 0c1a222636 | |||
| 8716b4ad73 | |||
| 6fcfefec8f | |||
| b696a79f4b | |||
| 61ed765d87 | |||
| 2703689e4e | |||
| b24c50722f | |||
| 3ec23a9f79 | |||
| 75fe6b55ad | |||
| fa2f980312 | |||
| 7964f1cd77 | |||
| dd611df9f5 | 
							
								
								
									
										14
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							| @@ -43,9 +43,16 @@ jobs: | ||||
|           --flash_mode dio \ | ||||
|           --flash_freq 40m \ | ||||
|           --flash_size 4MB \ | ||||
|           -o .pio/build/esp32dev/filaman.bin \ | ||||
|           -o .pio/build/esp32dev/filaman_full.bin \ | ||||
|           0x1000 .pio/build/esp32dev/bootloader.bin \ | ||||
|           0x8000 .pio/build/esp32dev/partitions.bin \ | ||||
|           0x10000 .pio/build/esp32dev/firmware.bin \ | ||||
|           0x290000 .pio/build/esp32dev/spiffs.bin | ||||
|  | ||||
|     - name: Prepare OTA firmware | ||||
|       run: | | ||||
|         # Use PlatformIO to create a proper OTA image | ||||
|         cp .pio/build/esp32dev/firmware.bin .pio/build/esp32dev/filaman_ota.bin | ||||
|      | ||||
|     - name: Get version from tag | ||||
|       id: get_version | ||||
| @@ -69,9 +76,10 @@ jobs: | ||||
|          | ||||
|     - name: Create Release with GitHub CLI | ||||
|       env: | ||||
|         GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Changed from GITHUB_TOKEN to GH_TOKEN | ||||
|         GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||
|       run: | | ||||
|         gh release create "${{ github.ref_name }}" \ | ||||
|           --title "Release ${{ steps.get_version.outputs.VERSION }}" \ | ||||
|           --notes "${{ steps.changelog.outputs.CHANGES }}" \ | ||||
|           ".pio/build/esp32dev/filaman.bin#filaman.bin" | ||||
|           ".pio/build/esp32dev/filaman_full.bin#filaman_full.bin" \ | ||||
|           ".pio/build/esp32dev/filaman_ota.bin#filaman_ota.bin" | ||||
							
								
								
									
										26
									
								
								CHANGELOG.md
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								CHANGELOG.md
									
									
									
									
									
								
							| @@ -1,5 +1,31 @@ | ||||
| # Changelog | ||||
|  | ||||
| ## [1.2.0] - 2025-02-17 | ||||
| ### Added | ||||
| - implement OTA functionality and update build scripts; change upgrade link to OTA in HTML | ||||
| - update version to v1.2.0 and modify build scripts in platformio.ini; remove unused includes in scale.cpp and website.cpp | ||||
| - update version to v1.2.0 and add upgrade link in HTML files | ||||
| - add esp_wifi.h and set maximum transmit power in WiFi initialization | ||||
|  | ||||
| ### Changed | ||||
| - update changelog for version 1.1.0 | ||||
| - clean up changelog and update script execution in platformio.ini | ||||
| - update changelog for version 1.1.0 | ||||
|  | ||||
| ### Fixed | ||||
| - update version number in header to v1.1.0 | ||||
| - correct version number in nav bar | ||||
|  | ||||
|  | ||||
| ## [1.1.0] - 2025-02-16 | ||||
| ### Changed | ||||
| - clean up changelog and update script execution in platformio.ini | ||||
| - update changelog for version 1.1.0 | ||||
|  | ||||
| ### Fixed | ||||
| - correct version number in nav bar | ||||
|  | ||||
|  | ||||
| ## [1.0.5] - 2025-02-16 | ||||
| ### Added | ||||
| - update version to 1.0.5 and enhance changelog update process with automatic git push | ||||
|   | ||||
| @@ -12,7 +12,7 @@ | ||||
|         <div style="display: flex; align-items: center; gap: 2rem;"> | ||||
|             <img src="/logo.png" alt="FilaMan Logo" class="logo"> | ||||
|             <div class="logo-text"> | ||||
|                 <h1>FilaMan<span class="version">v1.0.2</span></h1> | ||||
|                 <h1>FilaMan<span class="version">v1.2.0</span></h1> | ||||
|                 <h4>Filament Management Tool</h4> | ||||
|             </div> | ||||
|         </div> | ||||
| @@ -21,6 +21,7 @@ | ||||
|             <a href="/waage">Scale</a> | ||||
|             <a href="/spoolman">Spoolman/Bambu</a> | ||||
|             <a href="/about">About</a> | ||||
|             <a href="/ota">Upgrade</a> | ||||
|         </nav> | ||||
|         <div class="status-container"> | ||||
|             <div class="status-item"> | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| <!DOCTYPE html> | ||||
| <!-- head --><!DOCTYPE html> | ||||
| <html lang="en"> | ||||
| <head> | ||||
|     <meta charset="UTF-8"> | ||||
| @@ -12,7 +12,7 @@ | ||||
|         <div style="display: flex; align-items: center; gap: 2rem;"> | ||||
|             <img src="/logo.png" alt="FilaMan Logo" class="logo"> | ||||
|             <div class="logo-text"> | ||||
|                 <h1>FilaMan<span class="version">v1.0.2</span></h1> | ||||
|                 <h1>FilaMan<span class="version">v1.2.0</span></h1> | ||||
|                 <h4>Filament Management Tool</h4> | ||||
|             </div> | ||||
|         </div> | ||||
| @@ -21,6 +21,7 @@ | ||||
|             <a href="/waage">Scale</a> | ||||
|             <a href="/spoolman">Spoolman/Bambu</a> | ||||
|             <a href="/about">About</a> | ||||
|             <a href="/upgrade">Upgrade</a> | ||||
|         </nav> | ||||
|         <div class="status-container"> | ||||
|             <div class="status-item"> | ||||
| @@ -33,7 +34,7 @@ | ||||
|         </div> | ||||
|     </div> | ||||
|  | ||||
|  | ||||
| <!-- head --> | ||||
|  | ||||
|     <div class="container"> | ||||
|         <h1>FilaMan</h1> | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| <!DOCTYPE html> | ||||
| <!-- head --><!DOCTYPE html> | ||||
| <html lang="en"> | ||||
| <head> | ||||
|     <meta charset="UTF-8"> | ||||
| @@ -12,7 +12,7 @@ | ||||
|         <div style="display: flex; align-items: center; gap: 2rem;"> | ||||
|             <img src="/logo.png" alt="FilaMan Logo" class="logo"> | ||||
|             <div class="logo-text"> | ||||
|                 <h1>FilaMan<span class="version">v1.0.2</span></h1> | ||||
|                 <h1>FilaMan<span class="version">v1.2.0</span></h1> | ||||
|                 <h4>Filament Management Tool</h4> | ||||
|             </div> | ||||
|         </div> | ||||
| @@ -21,6 +21,7 @@ | ||||
|             <a href="/waage">Scale</a> | ||||
|             <a href="/spoolman">Spoolman/Bambu</a> | ||||
|             <a href="/about">About</a> | ||||
|             <a href="/upgrade">Upgrade</a> | ||||
|         </nav> | ||||
|         <div class="status-container"> | ||||
|             <div class="status-item"> | ||||
| @@ -33,6 +34,7 @@ | ||||
|         </div> | ||||
|     </div> | ||||
|  | ||||
| <!-- head --> | ||||
|  | ||||
| <div class="connection-status hidden"> | ||||
|     <div class="spinner"></div> | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| <!DOCTYPE html> | ||||
| <!-- head --><!DOCTYPE html> | ||||
| <html lang="en"> | ||||
| <head> | ||||
|     <meta charset="UTF-8"> | ||||
| @@ -12,7 +12,7 @@ | ||||
|         <div style="display: flex; align-items: center; gap: 2rem;"> | ||||
|             <img src="/logo.png" alt="FilaMan Logo" class="logo"> | ||||
|             <div class="logo-text"> | ||||
|                 <h1>FilaMan<span class="version">v1.0.2</span></h1> | ||||
|                 <h1>FilaMan<span class="version">v1.2.0</span></h1> | ||||
|                 <h4>Filament Management Tool</h4> | ||||
|             </div> | ||||
|         </div> | ||||
| @@ -21,6 +21,7 @@ | ||||
|             <a href="/waage">Scale</a> | ||||
|             <a href="/spoolman">Spoolman/Bambu</a> | ||||
|             <a href="/about">About</a> | ||||
|             <a href="/upgrade">Upgrade</a> | ||||
|         </nav> | ||||
|         <div class="status-container"> | ||||
|             <div class="status-item"> | ||||
| @@ -33,6 +34,7 @@ | ||||
|         </div> | ||||
|     </div> | ||||
|  | ||||
| <!-- head --> | ||||
|  | ||||
|     <script> | ||||
|         window.onload = function() { | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| <!DOCTYPE html> | ||||
| <!-- head --><!DOCTYPE html> | ||||
| <html lang="en"> | ||||
| <head> | ||||
|     <meta charset="UTF-8"> | ||||
| @@ -12,7 +12,7 @@ | ||||
|         <div style="display: flex; align-items: center; gap: 2rem;"> | ||||
|             <img src="/logo.png" alt="FilaMan Logo" class="logo"> | ||||
|             <div class="logo-text"> | ||||
|                 <h1>FilaMan<span class="version">v1.0.2</span></h1> | ||||
|                 <h1>FilaMan<span class="version">v1.2.0</span></h1> | ||||
|                 <h4>Filament Management Tool</h4> | ||||
|             </div> | ||||
|         </div> | ||||
| @@ -21,6 +21,7 @@ | ||||
|             <a href="/waage">Scale</a> | ||||
|             <a href="/spoolman">Spoolman/Bambu</a> | ||||
|             <a href="/about">About</a> | ||||
|             <a href="/upgrade">Upgrade</a> | ||||
|         </nav> | ||||
|         <div class="status-container"> | ||||
|             <div class="status-item"> | ||||
| @@ -33,6 +34,7 @@ | ||||
|         </div> | ||||
|     </div> | ||||
|  | ||||
| <!-- head --> | ||||
|  | ||||
|     <div class="content"> | ||||
|         <h1>Scale Configuration Page</h1> | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| <!DOCTYPE html> | ||||
| <!-- head --><!DOCTYPE html> | ||||
| <html lang="en"> | ||||
| <head> | ||||
|     <meta charset="UTF-8"> | ||||
| @@ -12,7 +12,7 @@ | ||||
|         <div style="display: flex; align-items: center; gap: 2rem;"> | ||||
|             <img src="/logo.png" alt="FilaMan Logo" class="logo"> | ||||
|             <div class="logo-text"> | ||||
|                 <h1>FilaMan<span class="version">v1.0.2</span></h1> | ||||
|                 <h1>FilaMan<span class="version">v1.2.0</span></h1> | ||||
|                 <h4>Filament Management Tool</h4> | ||||
|             </div> | ||||
|         </div> | ||||
| @@ -21,6 +21,7 @@ | ||||
|             <a href="/waage">Scale</a> | ||||
|             <a href="/spoolman">Spoolman/Bambu</a> | ||||
|             <a href="/about">About</a> | ||||
|             <a href="/upgrade">Upgrade</a> | ||||
|         </nav> | ||||
|         <div class="status-container"> | ||||
|             <div class="status-item"> | ||||
| @@ -33,6 +34,7 @@ | ||||
|         </div> | ||||
|     </div> | ||||
|  | ||||
| <!-- head --> | ||||
|  | ||||
|     <div class="content"> | ||||
|         <h1>WiFi Configuration Page</h1> | ||||
|   | ||||
| @@ -1,5 +1,5 @@ | ||||
| # Name,   Type, SubType, Offset,  Size, Flags | ||||
| nvs,      data, nvs,     0x9000,  0x5000, | ||||
| otadata,  data, ota,     0xe000,  0x2000, | ||||
| app0,     app,  ota_0,   0x10000, 0x280000, | ||||
| spiffs,   data, spiffs,  0x290000,0x170000, | ||||
| # Name,   Type, SubType, Offset,   Size,     Flags | ||||
| nvs,      data, nvs,     0x9000,   0x5000, | ||||
| otadata,  data, ota,     0xe000,   0x2000, | ||||
| app0,     app,  ota_0,   0x10000,  0x280000, | ||||
| spiffs,   data, spiffs,  0x290000, 0x170000, | ||||
| 
 | 
| @@ -9,7 +9,7 @@ | ||||
| ; https://docs.platformio.org/page/projectconf.html | ||||
|  | ||||
| [common] | ||||
| version = "1.0.6" | ||||
| version = "1.2.0" | ||||
|  | ||||
| [env:esp32dev] | ||||
| platform = espressif32 | ||||
| @@ -19,7 +19,8 @@ monitor_speed = 115200 | ||||
|  | ||||
| lib_deps = | ||||
|     tzapu/WiFiManager @ ^2.0.17 | ||||
|     me-no-dev/ESP Async WebServer @ ^1.2.4 | ||||
|     #me-no-dev/ESP Async WebServer @ ^1.2.4 | ||||
|     https://github.com/me-no-dev/ESPAsyncWebServer.git#master | ||||
|     me-no-dev/AsyncTCP @ ^1.1.1 | ||||
|     bogde/HX711 @ ^0.7.5 | ||||
|     adafruit/Adafruit SSD1306 @ ^2.5.13 | ||||
| @@ -28,12 +29,16 @@ lib_deps = | ||||
|     bblanchon/ArduinoJson @ ^7.3.0 | ||||
|     knolleary/PubSubClient @ ^2.8 | ||||
|     digitaldragon/SSLClient @ ^1.3.2 | ||||
|     ipdotsetaf/ESPAsyncHTTPUpdateServer @ ^2.0.0 | ||||
|      | ||||
| ; Enable SPIFFS upload | ||||
| board_build.filesystem = spiffs | ||||
| board_build.spiffs.partition = 2M | ||||
| board_build.spiffs.upload_size = 2M | ||||
| ; Update partition settings | ||||
| board_build.partitions = partitions.csv | ||||
| board_upload.flash_size = 4MB | ||||
| ; Remove these as they're now defined in partitions.csv | ||||
| ; board_build.spiffs.partition = 2M | ||||
| ; board_build.spiffs.upload_size = 2M | ||||
|  | ||||
| build_flags =  | ||||
|     -Os | ||||
| @@ -44,9 +49,16 @@ build_flags = | ||||
|     '-D VERSION="${common.version}"' | ||||
|  | ||||
| extra_scripts =  | ||||
|     pre:scripts/combine_html.py | ||||
|     pre:scripts/pre_build.py | ||||
|     pre:scripts/pre_spiffs.py | ||||
|     pre:scripts/gzip_files.py | ||||
|     pre:scripts/extra_script.py | ||||
|     pre:scripts/update_changelog.py | ||||
|     scripts/extra_script.py | ||||
|     pre:scripts/pre_build.py     ; wird zuerst ausgeführt | ||||
|     pre:scripts/pre_spiffs.py    ; wird als zweites ausgeführt | ||||
|     pre:scripts/combine_html.py  ; wird als drittes ausgeführt | ||||
|     scripts/gzip_files.py | ||||
|  | ||||
| ; Remove or comment out the targets line | ||||
| ;targets = buildfs, build | ||||
|  | ||||
| ; Add a custom target to build both | ||||
| [platformio] | ||||
| default_envs = esp32dev | ||||
|  | ||||
|   | ||||
| @@ -1,7 +1,10 @@ | ||||
| Import("env") | ||||
| import os | ||||
| import re | ||||
|  | ||||
| def combine_html_files(source, target, env): | ||||
|     print("COMBINE HTML FILES") | ||||
|      | ||||
|     html_dir = "./html" | ||||
|     header_file = os.path.join(html_dir, "header.html") | ||||
|      | ||||
| @@ -18,14 +21,14 @@ def combine_html_files(source, target, env): | ||||
|             with open(file_path, 'r') as f: | ||||
|                 content = f.read() | ||||
|              | ||||
|             # Replace placeholder with header content | ||||
|             if '{{header}}' in content: | ||||
|                 new_content = content.replace('{{header}}', header_content) | ||||
|                  | ||||
|                 # Write back combined content | ||||
|                 with open(file_path, 'w') as f: | ||||
|                     f.write(new_content) | ||||
|                 print(f"Combined header with {filename}") | ||||
|             # Replace content between head comments with header content | ||||
|             pattern = r'(<!-- head -->).*?(<!-- head -->)' | ||||
|             new_content = re.sub(pattern, r'\1' + header_content + r'\2', content, flags=re.DOTALL) | ||||
|              | ||||
|             # Write back combined content | ||||
|             with open(file_path, 'w') as f: | ||||
|                 f.write(new_content) | ||||
|             print(f"Combined header with {filename}") | ||||
|  | ||||
| # Register the script to run before building SPIFFS | ||||
| env.AddPreAction("buildfs", combine_html_files) | ||||
| @@ -13,6 +13,9 @@ def copy_file(input_file, output_file): | ||||
|     shutil.copy2(input_file, output_file) | ||||
|  | ||||
| def should_compress(file): | ||||
|      # Skip compression for spoolman.html | ||||
|     if file == 'spoolman.html': | ||||
|         return False | ||||
|     # Komprimiere nur bestimmte Dateitypen | ||||
|     return file.endswith(('.js', '.png', '.css', '.html')) | ||||
|  | ||||
|   | ||||
| @@ -22,4 +22,4 @@ def replace_version(source, target, env): | ||||
|     with open(header_file, 'w') as file: | ||||
|         file.write(content) | ||||
|  | ||||
| env.AddPreAction("buildfs", replace_version) | ||||
| env.AddPreAction("buildfs", replace_version) | ||||
|   | ||||
| @@ -78,19 +78,15 @@ def push_changes(version): | ||||
|         subprocess.run(['git', 'push', 'origin'], check=True) | ||||
|         print("Successfully pushed to origin") | ||||
|          | ||||
|         # Ask for upstream push | ||||
|         response = input("Do you want to push to GitHub (upstream)? (y/n): ").lower() | ||||
|         if response == 'y': | ||||
|             subprocess.run(['git', 'push', 'upstream'], check=True) | ||||
|             print("Successfully pushed to upstream") | ||||
|              | ||||
|     except subprocess.CalledProcessError as e: | ||||
|         print(f"Error during git operations: {e}") | ||||
|         return False | ||||
|     return True | ||||
|  | ||||
| def update_changelog(): | ||||
|     print("Starting changelog update...")  # Add this line | ||||
|     version = get_version() | ||||
|     print(f"Current version: {version}")   # Add this line | ||||
|     today = datetime.now().strftime('%Y-%m-%d') | ||||
|      | ||||
|     script_dir = os.path.dirname(os.path.abspath(__file__)) | ||||
|   | ||||
							
								
								
									
										48
									
								
								src/main.cpp
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								src/main.cpp
									
									
									
									
									
								
							| @@ -1,10 +1,10 @@ | ||||
| #include <Arduino.h> | ||||
| #include <WiFi.h> | ||||
| #include <DNSServer.h> | ||||
| #include <WiFiManager.h> | ||||
| #include <ESPmDNS.h> | ||||
| #include <Wire.h> | ||||
| #include <WiFi.h> | ||||
|  | ||||
| #include "wlan.h" | ||||
| #include "config.h" | ||||
| #include "website.h" | ||||
| #include "api.h" | ||||
| @@ -15,12 +15,6 @@ | ||||
| #include "esp_task_wdt.h" | ||||
| #include "commonFS.h" | ||||
|  | ||||
| // ***** WIFI initialisieren | ||||
| WiFiManager wm; | ||||
| bool wm_nonblocking = false; | ||||
| void initWiFi(); | ||||
| // ################### Functions | ||||
|  | ||||
| // ##### SETUP ##### | ||||
| void setup() { | ||||
|   Serial.begin(115200); | ||||
| @@ -96,9 +90,6 @@ void loop() { | ||||
|  | ||||
|   unsigned long currentMillis = millis(); | ||||
|  | ||||
|   // Falls WifiManager im nicht blockenden Modus ist | ||||
|   //if(wm_nonblocking) wm.process(); | ||||
|  | ||||
|   // Send AMS Data min every Minute | ||||
|   if (currentMillis - lastAmsSendTime >= amsSendInterval) { | ||||
|     lastAmsSendTime = currentMillis; | ||||
| @@ -164,38 +155,3 @@ void loop() { | ||||
|   yield(); | ||||
|   esp_task_wdt_reset(); | ||||
| } | ||||
|  | ||||
| // ##### Funktionen für Konfiguration ##### | ||||
| void initWiFi() { | ||||
|   WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP | ||||
|  | ||||
|   if(wm_nonblocking) wm.setConfigPortalBlocking(false); | ||||
|   wm.setConfigPortalTimeout(320); // Portal nach 5min schließen | ||||
|  | ||||
|   oledShowTopRow(); | ||||
|   oledShowMessage("WiFi Setup"); | ||||
|    | ||||
|   bool res; | ||||
|   // res = wm.autoConnect(); // auto generated AP name from chipid | ||||
|   res = wm.autoConnect("FilaMan"); // anonymous ap | ||||
|   // res = wm.autoConnect("spoolman","password"); // password protected ap | ||||
|  | ||||
|   if(!res) { | ||||
|     Serial.println("Failed to connect or hit timeout"); | ||||
|     // ESP.restart(); | ||||
|     oledShowTopRow(); | ||||
|     oledShowMessage("WiFi not connected Check Portal"); | ||||
|   }  | ||||
|   else { | ||||
|     wifiOn = true; | ||||
|  | ||||
|     //if you get here you have connected to the WiFi     | ||||
|     Serial.println("connected...yeey :)"); | ||||
|     Serial.print("IP address: "); | ||||
|     Serial.println(WiFi.localIP()); | ||||
|  | ||||
|     oledShowTopRow(); | ||||
|     display.display(); | ||||
|   } | ||||
| } | ||||
| // ##### Funktionen für Konfiguration Ende ##### | ||||
|   | ||||
							
								
								
									
										11
									
								
								src/ota.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/ota.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,11 @@ | ||||
| #include <Arduino.h> | ||||
| #include "ota.h" | ||||
| #include <ESPAsyncWebServer.h> | ||||
| #include <ESPAsyncHTTPUpdateServer.h> | ||||
|  | ||||
| ESPAsyncHTTPUpdateServer updateServer; | ||||
|  | ||||
| void setupOTA(AsyncWebServer &server) { | ||||
|     updateServer.setup(&server, "/ota", "admin", "admin"); | ||||
|     //updateServer.setup(&server); | ||||
| } | ||||
							
								
								
									
										8
									
								
								src/ota.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/ota.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| #ifndef OTA_H | ||||
| #define OTA_H | ||||
|  | ||||
| #include <ESPAsyncWebServer.h> | ||||
|  | ||||
| void setupOTA(AsyncWebServer &server); | ||||
|  | ||||
| #endif | ||||
| @@ -5,7 +5,6 @@ | ||||
| #include "HX711.h" | ||||
| #include <EEPROM.h> | ||||
| #include "display.h" | ||||
| #include "nfc.h" | ||||
| #include "esp_task_wdt.h" | ||||
|  | ||||
| HX711 scale; | ||||
|   | ||||
| @@ -3,11 +3,11 @@ | ||||
| #include "api.h" | ||||
| #include <ArduinoJson.h> | ||||
| #include <ESPAsyncWebServer.h> | ||||
| //#include <AsyncWebSocket.h> | ||||
| #include "bambu.h" | ||||
| #include "nfc.h" | ||||
| #include "scale.h" | ||||
| #include "esp_task_wdt.h" | ||||
| #include "ota.h" | ||||
|  | ||||
| // Cache-Control Header definieren | ||||
| #define CACHE_CONTROL "max-age=31536000" // Cache für 1 Jahr | ||||
| @@ -161,6 +161,8 @@ void setupWebserver(AsyncWebServer &server) { | ||||
|     Serial.print("Geladene Spoolman-URL: "); | ||||
|     Serial.println(spoolmanUrl); | ||||
|  | ||||
|     setupOTA(server); | ||||
|  | ||||
|     // Route für about | ||||
|     server.on("/about", HTTP_GET, [](AsyncWebServerRequest *request){ | ||||
|         Serial.println("Anfrage für /about erhalten"); | ||||
|   | ||||
							
								
								
									
										45
									
								
								src/wlan.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								src/wlan.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,45 @@ | ||||
| #include <Arduino.h> | ||||
| #include "wlan.h" | ||||
| #include <WiFi.h> | ||||
| #include <esp_wifi.h> | ||||
| #include <WiFiManager.h> | ||||
| #include "display.h" | ||||
| #include "config.h" | ||||
|  | ||||
| WiFiManager wm; | ||||
| bool wm_nonblocking = false; | ||||
|  | ||||
| void initWiFi() { | ||||
|     WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP | ||||
|    | ||||
|     esp_wifi_set_max_tx_power(72); // Setze maximale Sendeleistung auf 20dBm | ||||
|    | ||||
|     if(wm_nonblocking) wm.setConfigPortalBlocking(false); | ||||
|     wm.setConfigPortalTimeout(320); // Portal nach 5min schließen | ||||
|    | ||||
|     oledShowTopRow(); | ||||
|     oledShowMessage("WiFi Setup"); | ||||
|      | ||||
|     bool res; | ||||
|     // res = wm.autoConnect(); // auto generated AP name from chipid | ||||
|     res = wm.autoConnect("FilaMan"); // anonymous ap | ||||
|     // res = wm.autoConnect("spoolman","password"); // password protected ap | ||||
|    | ||||
|     if(!res) { | ||||
|       Serial.println("Failed to connect or hit timeout"); | ||||
|       // ESP.restart(); | ||||
|       oledShowTopRow(); | ||||
|       oledShowMessage("WiFi not connected Check Portal"); | ||||
|     }  | ||||
|     else { | ||||
|       wifiOn = true; | ||||
|    | ||||
|       //if you get here you have connected to the WiFi     | ||||
|       Serial.println("connected...yeey :)"); | ||||
|       Serial.print("IP address: "); | ||||
|       Serial.println(WiFi.localIP()); | ||||
|    | ||||
|       oledShowTopRow(); | ||||
|       display.display(); | ||||
|     } | ||||
|   } | ||||
							
								
								
									
										8
									
								
								src/wlan.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/wlan.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| #ifndef WLAN_H | ||||
| #define WLAN_H | ||||
|  | ||||
| #include <Arduino.h> | ||||
|  | ||||
| void initWiFi(); | ||||
|  | ||||
| #endif | ||||
		Reference in New Issue
	
	Block a user