added input field for IP address

development
Thiemann96 5 years ago
parent d03b613cc7
commit f1ed71417b

@ -81,6 +81,7 @@
"STEP2": "drücke den roten 'Reset' Knopf einmal", "STEP2": "drücke den roten 'Reset' Knopf einmal",
"STEP3": "lasse den 'Switch' Knopf nach einer Sekunde los.", "STEP3": "lasse den 'Switch' Knopf nach einer Sekunde los.",
"AUTOMATIC": { "AUTOMATIC": {
"STEP0": "IP Addresse der senseBox: ",
"STEP1": "Laden den Over-the-Air Sketch der openSenseMap auf die 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", "STEP2": "Verbinde dich mit gleichen Netzwekr in dem die senseBox eingewählt ist",
"STEP3": "Klicke auf 'Weiter'!" "STEP3": "Klicke auf 'Weiter'!"

@ -75,6 +75,7 @@
"STEP2": "press the red r eset button shortly", "STEP2": "press the red r eset button shortly",
"STEP3": "release the switch button after one second", "STEP3": "release the switch button after one second",
"AUTOMATIC": { "AUTOMATIC": {
"STEP0": "IP Address of the senseBox: ",
"STEP1": "Upload the Over-the-Air Sketch from the OpenSenseMap to 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", "STEP2": "Connect this device to the same network the senseBox is connected with",
"STEP3": "Click Continue!" "STEP3": "Click Continue!"

@ -120,7 +120,11 @@
<ion-grid *ngIf="modus === 'automatic' "> <ion-grid *ngIf="modus === 'automatic' ">
<ion-row align-items-center> <ion-row align-items-center>
<ion-col col-12 col-md-6> <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.STEP1' | translate"></li>
<li [innerHTML]="'OTAWIZ.OTAMODE.AUTOMATIC.STEP2' | translate"></li> <li [innerHTML]="'OTAWIZ.OTAMODE.AUTOMATIC.STEP2' | translate"></li>
<li [innerHTML]="'OTAWIZ.OTAMODE.AUTOMATIC.STEP3' | 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 slideHistory: string[] = [OtaSlides[OtaSlides.Intro]] // for debug info in logs
private counts = { compile: 0, connect: 0, upload: 0 } private counts = { compile: 0, connect: 0, upload: 0 }
private modus; private modus;
private OTAAddress = '192.168.0.46'
private wifiSlideHidden = false; private wifiSlideHidden = false;
constructor( constructor(
private network: Network, private network: Network,
@ -136,12 +137,14 @@ export class OtaWizardPage implements OnInit, OnDestroy {
showAutomatic() { showAutomatic() {
this.hideSlide(OtaSlides.WifiSelection); this.hideSlide(OtaSlides.WifiSelection);
this.modus = "automatic"; this.modus = "automatic";
this.OTAAddress = '192.168.0.46'
this.slides.lockSwipeToNext(false); this.slides.lockSwipeToNext(false);
this.slides.slideNext() this.slides.slideNext()
} }
showManual() { showManual() {
this.modus = "manual"; this.modus = "manual";
this.OTAAddress = '192.168.1.1'
this.showSlide(this.slideWifi); this.showSlide(this.slideWifi);
this.slides.lockSwipeToNext(false); this.slides.lockSwipeToNext(false);
this.slides.slideNext() this.slides.slideNext()
@ -185,6 +188,7 @@ export class OtaWizardPage implements OnInit, OnDestroy {
} }
get currentSlide(): OtaSlides { get currentSlide(): OtaSlides {
console.log(this.OTAAddress);
let current = this.slides.getActiveIndex() let current = this.slides.getActiveIndex()
const hiddenOffset = this.hiddenSlides.filter(slide => slide <= current).length const hiddenOffset = this.hiddenSlides.filter(slide => slide <= current).length
if(current === 3 && this.slideIsHidden(this.slideWifi)){ if(current === 3 && this.slideIsHidden(this.slideWifi)){
@ -270,7 +274,7 @@ export class OtaWizardPage implements OnInit, OnDestroy {
this.state.upload = 'uploading' this.state.upload = 'uploading'
try { 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.log.debug(JSON.stringify(res, null, 2))
this.state.upload = 'done' this.state.upload = 'done'

@ -68,9 +68,9 @@ export class OtaWifiProvider {
: WifiWizard2.connect(ssid, true) // true: bind to all connections, even without internet : 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? // TODO: send checksum?
return this.http.post(`${URL_sensebox}/sketch`, binary, { return this.http.post(`${OTAAddress}/sketch`, binary, {
responseType: 'text', responseType: 'text',
}) })
.pipe(timeout(5000), catchError(err => { .pipe(timeout(5000), catchError(err => {

Loading…
Cancel
Save