mirror of
https://github.com/sensebox/blockly-app
synced 2025-04-09 06:30:27 +02:00
added input field for IP address
This commit is contained in:
parent
d03b613cc7
commit
f1ed71417b
5 changed files with 65 additions and 55 deletions
|
@ -81,6 +81,7 @@
|
|||
"STEP2": "drücke den roten 'Reset' Knopf einmal",
|
||||
"STEP3": "lasse den 'Switch' Knopf nach einer Sekunde los.",
|
||||
"AUTOMATIC": {
|
||||
"STEP0": "IP Addresse der senseBox: ",
|
||||
"STEP1": "Laden den Over-the-Air Sketch der openSenseMap auf die senseBox",
|
||||
"STEP2": "Verbinde dich mit gleichen Netzwekr in dem die senseBox eingewählt ist",
|
||||
"STEP3": "Klicke auf 'Weiter'!"
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
"STEP2": "press the red r eset button shortly",
|
||||
"STEP3": "release the switch button after one second",
|
||||
"AUTOMATIC": {
|
||||
"STEP0": "IP Address of the senseBox: ",
|
||||
"STEP1": "Upload the Over-the-Air Sketch from the OpenSenseMap to the senseBox",
|
||||
"STEP2": "Connect this device to the same network the senseBox is connected with",
|
||||
"STEP3": "Click Continue!"
|
||||
|
|
|
@ -120,7 +120,11 @@
|
|||
<ion-grid *ngIf="modus === 'automatic' ">
|
||||
<ion-row align-items-center>
|
||||
<ion-col col-12 col-md-6>
|
||||
<ol style="text-align: left">
|
||||
<ol style="text-align: left" start="0">
|
||||
<li>
|
||||
{{ 'OTAWIZ.OTAMODE.AUTOMATIC.STEP0' | translate }}
|
||||
<input [(ngModel)]="OTAAddress" placeholder=" 'OTAWIZ.OTAMODE.AUTOMATIC.IPINPUT' | translate"/>
|
||||
</li>
|
||||
<li [innerHTML]="'OTAWIZ.OTAMODE.AUTOMATIC.STEP1' | translate"></li>
|
||||
<li [innerHTML]="'OTAWIZ.OTAMODE.AUTOMATIC.STEP2' | translate"></li>
|
||||
<li [innerHTML]="'OTAWIZ.OTAMODE.AUTOMATIC.STEP3' | translate"></li>
|
||||
|
|
|
@ -52,6 +52,7 @@ export class OtaWizardPage implements OnInit, OnDestroy {
|
|||
private slideHistory: string[] = [OtaSlides[OtaSlides.Intro]] // for debug info in logs
|
||||
private counts = { compile: 0, connect: 0, upload: 0 }
|
||||
private modus;
|
||||
private OTAAddress = '192.168.0.46'
|
||||
private wifiSlideHidden = false;
|
||||
constructor(
|
||||
private network: Network,
|
||||
|
@ -136,12 +137,14 @@ export class OtaWizardPage implements OnInit, OnDestroy {
|
|||
showAutomatic() {
|
||||
this.hideSlide(OtaSlides.WifiSelection);
|
||||
this.modus = "automatic";
|
||||
this.OTAAddress = '192.168.0.46'
|
||||
this.slides.lockSwipeToNext(false);
|
||||
this.slides.slideNext()
|
||||
}
|
||||
|
||||
showManual() {
|
||||
this.modus = "manual";
|
||||
this.OTAAddress = '192.168.1.1'
|
||||
this.showSlide(this.slideWifi);
|
||||
this.slides.lockSwipeToNext(false);
|
||||
this.slides.slideNext()
|
||||
|
@ -185,6 +188,7 @@ export class OtaWizardPage implements OnInit, OnDestroy {
|
|||
}
|
||||
|
||||
get currentSlide(): OtaSlides {
|
||||
console.log(this.OTAAddress);
|
||||
let current = this.slides.getActiveIndex()
|
||||
const hiddenOffset = this.hiddenSlides.filter(slide => slide <= current).length
|
||||
if(current === 3 && this.slideIsHidden(this.slideWifi)){
|
||||
|
@ -270,7 +274,7 @@ export class OtaWizardPage implements OnInit, OnDestroy {
|
|||
this.state.upload = 'uploading'
|
||||
try {
|
||||
|
||||
const res = await this.otaWifi.uploadFirmware(this.compiledSketch)
|
||||
const res = await this.otaWifi.uploadFirmware(this.compiledSketch,this.OTAAddress)
|
||||
this.log.debug(JSON.stringify(res, null, 2))
|
||||
|
||||
this.state.upload = 'done'
|
||||
|
|
|
@ -68,9 +68,9 @@ export class OtaWifiProvider {
|
|||
: WifiWizard2.connect(ssid, true) // true: bind to all connections, even without internet
|
||||
}
|
||||
|
||||
async uploadFirmware (binary: ArrayBuffer): Promise<any> {
|
||||
async uploadFirmware (binary: ArrayBuffer,OTAAddress:String): Promise<any> {
|
||||
// TODO: send checksum?
|
||||
return this.http.post(`${URL_sensebox}/sketch`, binary, {
|
||||
return this.http.post(`${OTAAddress}/sketch`, binary, {
|
||||
responseType: 'text',
|
||||
})
|
||||
.pipe(timeout(5000), catchError(err => {
|
||||
|
|
Loading…
Add table
Reference in a new issue