mc-Things
mc-Products => mc-Studio => Topic started by: rudydevolder on October 27, 2017, 01:52:13 am
-
After just adding a file to my project, and only calling the constructor my MC-120 module hangs, I can't connect any more and I must first connect via MC-OTA-updater to erase the script.
So the only instructions executed in my Class are:
Class WaterTank
Shared Address As Byte
Shared Sensor As I2c
Public Sub New(_address As Byte)
Address = _address
Sensor = I2c.Create(400000, Pin.SCL, Pin.SDA, Address)
End Sub
.......
End Class
And in my main program:
Shared UartTerm As UART_Debug
Shared WaterTank1 As WaterTank
Shared Event Boot()
Lplan.SetMidPowerMode(1)
Lplan.SetBeaconTime(2)
UartTerm = New UART_Debug()
WaterTank1 = New WaterTank(0x10)
End Event
I'm thinking maybe a memory leak in I2C ???
-
The problem is the SetMidPowerMode(1). 1 milisecond is to fast and something must overflow. The minimum value is 20 milliseconds but that takes a big load. Make it 250 or just remove the statement. Beaconing every 2 seconds is fast but should work.