added input field for IP address

development
Thiemann96 5 years ago
parent d03b613cc7
commit f1ed71417b

@ -6,7 +6,7 @@
"BLOCKLY": "Blockly", "BLOCKLY": "Blockly",
"DOCS": "Dokumentation", "DOCS": "Dokumentation",
"SETTINGS": "Einstellungen", "SETTINGS": "Einstellungen",
"MYSENSEBOX":"Meine senseBox" "MYSENSEBOX": "Meine senseBox"
}, },
"ABOUT": { "ABOUT": {
"TITLE": "Über", "TITLE": "Über",
@ -26,24 +26,24 @@
"BTN_CODE": "Quellcode Ansicht", "BTN_CODE": "Quellcode Ansicht",
"BTN_OTA": "OTA Upload" "BTN_OTA": "OTA Upload"
}, },
"CONFIG":{ "CONFIG": {
"WIFI":"WiFi Einstellungen", "WIFI": "WiFi Einstellungen",
"IDS":"senseBox und Sensor ID's", "IDS": "senseBox und Sensor ID's",
"DEBUG":"Debugging einschalten", "DEBUG": "Debugging einschalten",
"BUTTON":"Sketch hochladen!" "BUTTON": "Sketch hochladen!"
}, },
"MYSENSEBOX":{ "MYSENSEBOX": {
"TITLE":"Meine senseBox", "TITLE": "Meine senseBox",
"SHOW":"Zeige Sensoren", "SHOW": "Zeige Sensoren",
"SKETCH":"Sketch hochladen", "SKETCH": "Sketch hochladen",
"EXPOSURE":"Position" "EXPOSURE": "Position"
}, },
"LOGIN":{ "LOGIN": {
"LOADING":"Einloggen..." "LOADING": "Einloggen..."
}, },
"SENSORS":{ "SENSORS": {
"TYP":"Typ", "TYP": "Typ",
"MEASUREMENT":"Letzte Messung" "MEASUREMENT": "Letzte Messung"
}, },
"SETTINGS": { "SETTINGS": {
"TITLE": "Einstellungen", "TITLE": "Einstellungen",
@ -63,7 +63,7 @@
"TITLE": "Over The Air Programmierung", "TITLE": "Over The Air Programmierung",
"BTN_NEXT": "Weiter", "BTN_NEXT": "Weiter",
"BTN_CLOSE": "Schließen", "BTN_CLOSE": "Schließen",
"BTN_REQUEST":"OTA Modus aktivieren!", "BTN_REQUEST": "OTA Modus aktivieren!",
"BTN_BACK": "Zurück", "BTN_BACK": "Zurück",
"INTRO": { "INTRO": {
"TITLE": "Willkommen", "TITLE": "Willkommen",
@ -80,15 +80,16 @@
"STEP1": "halte den den 'Switch' Knopf (grau oder blau) gedrückt", "STEP1": "halte den den 'Switch' Knopf (grau oder blau) gedrückt",
"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": {
"STEP1":"Laden den Over-the-Air Sketch der openSenseMap auf die senseBox", "STEP0": "IP Addresse der senseBox: ",
"STEP2":"Verbinde dich mit gleichen Netzwekr in dem die senseBox eingewählt ist", "STEP1": "Laden den Over-the-Air Sketch der openSenseMap auf die senseBox",
"STEP3":"Klicke auf 'Weiter'!" "STEP2": "Verbinde dich mit gleichen Netzwekr in dem die senseBox eingewählt ist",
"STEP3": "Klicke auf 'Weiter'!"
} }
}, },
"OTAMODESELECTION":{ "OTAMODESELECTION": {
"AUTOMATIC":"Wähle diesen Modus wenn du den openSenseMap Sketch nach dem 20.03.2020 auf die senseBox hochgeladen hast!", "AUTOMATIC": "Wähle diesen Modus wenn du den openSenseMap Sketch nach dem 20.03.2020 auf die senseBox hochgeladen hast!",
"MANUAL":"Wähle diesen Modus aus um die senseBox manuell in den OTA Modus zu schalten!" "MANUAL": "Wähle diesen Modus aus um die senseBox manuell in den OTA Modus zu schalten!"
}, },
"COMPILATION": { "COMPILATION": {
"COMPILING": { "COMPILING": {
@ -128,4 +129,4 @@
"ERROR": "Fehler!" "ERROR": "Fehler!"
} }
} }
} }

@ -21,23 +21,23 @@
}, },
"HINT": "<em>Hint:</em> A <a href=\"https://blockly.sensebox.de\">web version of Blockly for senseBox</a> is available as well!" "HINT": "<em>Hint:</em> A <a href=\"https://blockly.sensebox.de\">web version of Blockly for senseBox</a> is available as well!"
}, },
"LOGIN":{ "LOGIN": {
"LOADING":"Logging in..." "LOADING": "Logging in..."
}, },
"BLOCKLY": { "BLOCKLY": {
"TITLE": "Blockly for senseBox", "TITLE": "Blockly for senseBox",
"BTN_CODE": "Code View", "BTN_CODE": "Code View",
"BTN_OTA": "OTA Programmer" "BTN_OTA": "OTA Programmer"
}, },
"MYSENSEBOX":{ "MYSENSEBOX": {
"TITLE":"My senseBox", "TITLE": "My senseBox",
"SHOW":"Show sensors", "SHOW": "Show sensors",
"SKETCH":"Upload Sketch", "SKETCH": "Upload Sketch",
"EXPOSURE":"Exposure" "EXPOSURE": "Exposure"
}, },
"SENSORS":{ "SENSORS": {
"TYP":"Type", "TYP": "Type",
"MEASUREMENT":"Last measurement" "MEASUREMENT": "Last measurement"
}, },
"SETTINGS": { "SETTINGS": {
"TITLE": "Settings", "TITLE": "Settings",
@ -58,7 +58,7 @@
"BTN_NEXT": "Continue", "BTN_NEXT": "Continue",
"BTN_CLOSE": "Close", "BTN_CLOSE": "Close",
"BTN_BACK": "Back", "BTN_BACK": "Back",
"BTN_REQUEST":"Enable OTA Mode", "BTN_REQUEST": "Enable OTA Mode",
"INTRO": { "INTRO": {
"TITLE": "Welcome", "TITLE": "Welcome",
"TEXT": "To transfer your code to your senseBox over the air (OTA), please follow these steps.", "TEXT": "To transfer your code to your senseBox over the air (OTA), please follow these steps.",
@ -74,15 +74,16 @@
"STEP1": "press &amp; hold the switch button (gray or blue)", "STEP1": "press &amp; hold the switch button (gray or blue)",
"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": {
"STEP1":"Upload the Over-the-Air Sketch from the OpenSenseMap to the senseBox", "STEP0": "IP Address of the senseBox: ",
"STEP2":"Connect this device to the same network the senseBox is connected with", "STEP1": "Upload the Over-the-Air Sketch from the OpenSenseMap to the senseBox",
"STEP3":"Click Continue!" "STEP2": "Connect this device to the same network the senseBox is connected with",
"STEP3": "Click Continue!"
} }
}, },
"OTAMODESELECTION":{ "OTAMODESELECTION": {
"AUTOMATIC":"Choose this mode if your senseBox is currently running an OpenSenseMap Sketch acquired after 20.03.2020", "AUTOMATIC": "Choose this mode if your senseBox is currently running an OpenSenseMap Sketch acquired after 20.03.2020",
"MANUAL":"Choose this mode if you have uploaded the OTA Sketch" "MANUAL": "Choose this mode if you have uploaded the OTA Sketch"
}, },
"COMPILATION": { "COMPILATION": {
"COMPILING": { "COMPILING": {
@ -122,11 +123,11 @@
"ERROR": "Error!" "ERROR": "Error!"
} }
}, },
"CONFIG":{ "CONFIG": {
"TITLE":"Initial configuration", "TITLE": "Initial configuration",
"BUTTON":"Upload Sketch!", "BUTTON": "Upload Sketch!",
"WIFI":"Configure WiFi Settings", "WIFI": "Configure WiFi Settings",
"IDS":"senseBox and sensor ID's", "IDS": "senseBox and sensor ID's",
"DEBUG":"Enable debugging" "DEBUG": "Enable debugging"
} }
} }

@ -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