Skip to content

Commit dc8e276

Browse files
committed
Improve simulation of wind direction
1 parent 514d009 commit dc8e276

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

pxt.json

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
"tests.ts"
2222
],
2323
"public": true,
24+
"targetVersions": {
25+
"target": "4.0.9",
26+
"targetId": "microbit"
27+
},
2428
"supportedTargets": [
2529
"microbit"
2630
],

tests.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ weatherbit.startRainMonitoring()
3434
weatherbit.startWindMonitoring()
3535
weatherbit.startWeatherMonitoring()
3636

37-
weatherbit.simWindAndRain()
37+
weatherbit.simWeather()

weatherbit.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace weatherbit {
3636
let windMPH = 0
3737
let directionArrow = [ArrowNames.North,ArrowNames.NorthEast,ArrowNames.East,ArrowNames.SouthEast,ArrowNames.South,ArrowNames.SouthWest,ArrowNames.West,ArrowNames.NorthWest]
3838
let directionString = ["N","NE","E","SE","S","SW","W","NW"]
39-
let simDirection = 360 // an illegal value that simulation can override
39+
let simDirection = 0 // North - but simulation will override
4040

4141
// BME280 Addresses
4242
const bmeAddr = 0x76
@@ -287,10 +287,10 @@ namespace weatherbit {
287287
}
288288

289289
/**
290-
* Simulate wind turns
290+
* Simulate weather - wind and rain
291291
*/
292-
//% weight=0 blockId="weatherbit_simWindTurns" block="simulate wind turns"
293-
export function simWindAndRain(): void {
292+
//% weight=0 blockId="weatherbit_simWeather" block="simulate weather"
293+
export function simWeather(): void {
294294
control.inBackground(() => {
295295
let i = 0
296296
while (true){
@@ -577,9 +577,9 @@ namespace weatherbit {
577577
/**
578578
* Reads the temperature from the one-wire temperature sensor.
579579
* Returns a 4 digit number. value should be divided by 100 to get
580-
* temperature in hudnreths of a degree centigrade.
580+
* temperature in hundreths of a degree centigrade.
581581
*/
582-
//% weight=10 blockId="weahterbit_soilTemp" block="soil temperature(C)"
582+
//% weight=10 blockId="weatherbit_soilTemp" block="soil temperature(C)"
583583
//%
584584
export function soilTemperature(): number {
585585
init();

0 commit comments

Comments
 (0)