You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A customer reported an error using the Kitronik smart greenhouse. His system gives compilation error.
If he removed the sensing blocks (the board has a BME280 on it) then the error went but the code was not functional.
we could not reproduce so asked him to send the actual code.
The Java representation is:
You will also need the Kitronik smart greenhouse extension loaded.
Not a very complex program. We have written more complex in the testing of the board before release.
We instructed him how to look at output.txt - this reports 'Everything seems fine!'
trying to compile his code I managed to catch a less optimistic output.txt which reported:
error: pxt_modules/pxt-kitronik-smart-greenhouse/main.ts(1,1): error TS9200: program too big by 1968 bytes!
(again with the Kitronik smart greenhouse extension)
This compiles and runs fine.
examination showed that the customer uses a music block. removing this allows his code to compile correctly.
looking in the build folder there is binary.js, which appears to have sizes of programs in the top of it.
The original customer code reported:
// total=182551 new=8.16% cached=89.30% other=2.54%
removing just the music block (startMelody) drops the size significantly:
// total=117016 new=11.99% cached=85.01% other=3.00%
suspiciously the difference is 65535. (bytes?)
Adding in the playMelody block, with an 8 note tune increases it back to:
// total=174870 new=8.44% cached=88.91% other=2.66%
still smaller, (57845 different) - small enough that it will compile with essentially the same functionality.
Our greenhouse test code reports:
// total=122867 new=13.41% cached=83.48% other=3.12%
and adding the startMelody block to that gives:
// total=188402 new=9.21% cached=88.16% other=2.63%
which also produces the error.
I have advised the customer of this workaround, but these are not (on the face of it) complex programs.
If our extension is to large then suggestions on how to minimise its size would be appreciated.
I have not found a definitive max size anywhere - if this info is available it would be useful.
micro:bit version (please complete the following information):
not hardware related - doesnt get as far as the download.
Desktop (please complete the following information):
OS: windows
Browser chrome and safari - not thought to be browser or OS related.
The text was updated successfully, but these errors were encountered:
Well, I was able to improve it a bit by switching from arrays to hex buffers (68531 -> 57546). Unfortunately, I'm not sure I can get much better than that without changing the API itself. We could probably improve both code size and memory usage if we switched to single strings instead of arrays of strings; but that would be a breaking change in TS (we could make it transparent in blocks)
A customer reported an error using the Kitronik smart greenhouse. His system gives compilation error.
If he removed the sensing blocks (the board has a BME280 on it) then the error went but the code was not functional.
we could not reproduce so asked him to send the actual code.
The Java representation is:
input.onButtonPressed(Button.A, function () {
music.startMelody(music.builtInMelody(Melodies.PowerUp), MelodyOptions.Once)
kitronik_smart_greenhouse.controlHighPowerPin(kitronik_smart_greenhouse.HighPowerPins.pin13, kitronik_smart_greenhouse.onOff(true))
basic.pause(100)
kitronik_smart_greenhouse.controlHighPowerPin(kitronik_smart_greenhouse.HighPowerPins.pin13, kitronik_smart_greenhouse.onOff(false))
})
let zipLEDs = kitronik_smart_greenhouse.createGreenhouseZIPDisplay(3)
kitronik_smart_greenhouse.setBuzzerPin()
kitronik_smart_greenhouse.setTime(0, 0, 0)
zipLEDs = kitronik_smart_greenhouse.createGreenhouseZIPDisplay(8)
let zipStick = zipLEDs.zipStickRange()
basic.forever(function () {
zipLEDs.setZipLedColor(0, kitronik_smart_greenhouse.colors(ZipLedColors.Red))
zipLEDs.setZipLedColor(1, kitronik_smart_greenhouse.colors(ZipLedColors.Green))
zipLEDs.setZipLedColor(2, kitronik_smart_greenhouse.colors(ZipLedColors.Blue))
zipLEDs.show()
basic.showString(kitronik_smart_greenhouse.readTime())
if (kitronik_smart_greenhouse.readIOPin(kitronik_smart_greenhouse.PinType.analog, kitronik_smart_greenhouse.IOPins.p0) > 500) {
basic.showIcon(IconNames.Happy)
} else {
basic.showIcon(IconNames.Sad)
}
basic.pause(1000)
basic.clearScreen()
basic.showString("P:")
basic.showNumber(kitronik_smart_greenhouse.pressure(PressureUnitList.mBar))
basic.pause(500)
basic.clearScreen()
basic.showString("T:")
basic.showNumber(kitronik_smart_greenhouse.temperature(TemperatureUnitList.C))
basic.pause(500)
basic.clearScreen()
basic.showString("H:")
basic.showNumber(kitronik_smart_greenhouse.humidity())
basic.pause(500)
basic.clearScreen()
zipStick.showColor(kitronik_smart_greenhouse.colors(ZipLedColors.Red))
basic.pause(2000)
zipStick.showColor(kitronik_smart_greenhouse.colors(ZipLedColors.Green))
basic.pause(2000)
zipStick.showColor(kitronik_smart_greenhouse.colors(ZipLedColors.Blue))
basic.pause(2000)
})
You will also need the Kitronik smart greenhouse extension loaded.
Not a very complex program. We have written more complex in the testing of the board before release.
We instructed him how to look at output.txt - this reports 'Everything seems fine!'
trying to compile his code I managed to catch a less optimistic output.txt which reported:
error: pxt_modules/pxt-kitronik-smart-greenhouse/main.ts(1,1): error TS9200: program too big by 1968 bytes!
which I have not seen before in a PXT program.
digging a bit further I loaded our test program:
input.onButtonPressed(Button.A, function () {
basic.showString(kitronik_smart_greenhouse.readTime())
basic.pause(500)
basic.showString("T:")
basic.showNumber(kitronik_smart_greenhouse.temperature(TemperatureUnitList.C))
basic.showString("C")
basic.pause(500)
basic.showString("H:")
basic.showNumber(kitronik_smart_greenhouse.humidity())
basic.showString("%")
basic.clearScreen()
})
input.onButtonPressed(Button.AB, function () {
if (!(lampOn)) {
lampOn = true
zipStick.showColor(kitronik_smart_greenhouse.colors(ZipLedColors.Yellow))
} else {
lampOn = false
zipStick.clear()
zipStick.show()
}
})
input.onButtonPressed(Button.B, function () {
kitronik_smart_greenhouse.controlHighPowerPin(kitronik_smart_greenhouse.HighPowerPins.pin13, kitronik_smart_greenhouse.onOff(true))
basic.pause(200)
kitronik_smart_greenhouse.controlHighPowerPin(kitronik_smart_greenhouse.HighPowerPins.pin13, kitronik_smart_greenhouse.onOff(false))
})
let soilHue = 0
let humidHue = 0
let tempHue = 0
let lampOn = false
let zipStick: kitronik_smart_greenhouse.greenhouseZIPLEDs = null
kitronik_smart_greenhouse.setDate(20, 1, 20)
kitronik_smart_greenhouse.setTime(15, 0, 0)
let zipLEDs = kitronik_smart_greenhouse.createGreenhouseZIPDisplay(8)
let statusLEDs = zipLEDs.statusLedsRange()
zipStick = zipLEDs.zipStickRange()
zipLEDs.setBrightness(255)
lampOn = false
basic.forever(function () {
tempHue = Math.map(kitronik_smart_greenhouse.temperature(TemperatureUnitList.C), 0, 40, 210, 0)
humidHue = Math.map(kitronik_smart_greenhouse.humidity(), 0, 100, 35, 150)
soilHue = Math.map(kitronik_smart_greenhouse.readIOPin(kitronik_smart_greenhouse.PinType.analog, kitronik_smart_greenhouse.IOPins.p1), 0, 1023, 35, 150)
statusLEDs.setZipLedColor(0, kitronik_smart_greenhouse.hueToRGB(tempHue))
statusLEDs.setZipLedColor(1, kitronik_smart_greenhouse.hueToRGB(humidHue))
statusLEDs.setZipLedColor(2, kitronik_smart_greenhouse.hueToRGB(soilHue))
statusLEDs.show()
})
(again with the Kitronik smart greenhouse extension)
This compiles and runs fine.
examination showed that the customer uses a music block. removing this allows his code to compile correctly.
looking in the build folder there is binary.js, which appears to have sizes of programs in the top of it.
The original customer code reported:
// total=182551 new=8.16% cached=89.30% other=2.54%
removing just the music block (startMelody) drops the size significantly:
// total=117016 new=11.99% cached=85.01% other=3.00%
suspiciously the difference is 65535. (bytes?)
Adding in the playMelody block, with an 8 note tune increases it back to:
// total=174870 new=8.44% cached=88.91% other=2.66%
still smaller, (57845 different) - small enough that it will compile with essentially the same functionality.
Our greenhouse test code reports:
// total=122867 new=13.41% cached=83.48% other=3.12%
and adding the startMelody block to that gives:
// total=188402 new=9.21% cached=88.16% other=2.63%
which also produces the error.
I have advised the customer of this workaround, but these are not (on the face of it) complex programs.
If our extension is to large then suggestions on how to minimise its size would be appreciated.
I have not found a definitive max size anywhere - if this info is available it would be useful.
micro:bit version (please complete the following information):
not hardware related - doesnt get as far as the download.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: