Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Nick_W

Pages: 1 ... 11 12 [13] 14 15
181
mc-Module / Re: Build Failure Message "Internal Error Instr Type*1024"
« on: August 25, 2016, 12:16:59 pm »
Any news on the new build?

I'm constantly running into this error now....

182
mc-Module / Re: Build Failure Message "Internal Error Instr Type*1024"
« on: August 24, 2016, 07:08:52 am »
Well I would find it useful, save me some effort with the Light sensor. While I wait for the new release, I'll get back to the MMA8652FC.

I usually don't like posting things on github until they are complete (and they are never complete). But I'll post what I have when it works.

183
mc-Module / Re: Build Failure Message "Internal Error Instr Type*1024"
« on: August 24, 2016, 12:24:18 am »
I can do,

Didn't know if you were planning a library section here, but Github is fine.

184
mc-Module / Re: Build Failure Message "Internal Error Instr Type*1024"
« on: August 23, 2016, 06:09:38 pm »
Thank you!

I will await the new version.

In the meantime I'm working on a door sensor, so I'm building an accelerometer library (based on the Alpha version you posted somewhere). Hopefully that won't get too big...

I have a TSL 2561 Light Sensor I'm also planning on trying - maybe I need more modules...

185
mc-Module / Re: Build Failure Message "Internal Error Instr Type*1024"
« on: August 23, 2016, 03:25:50 pm »
You'd be surprised....

I find it will build if I remove some Sub/Functions, but it doesn't matter which (just enough).

Project is attached. I really hope it's a bug of mine....

186
mc-Module / Build Failure Message "Internal Error Instr Type*1024"
« on: August 23, 2016, 12:27:45 pm »
I have a completed BME280 Library, which shows no errors in mcStudio, but fails to bulid with the error "Internal Error Instr Type*1024".

I'm not sure what this is - is it a memory error (the library is quite big)?

Thanks,

187
mc-Module / Re: Odd beacon Behaviour
« on: August 23, 2016, 12:14:32 pm »
Thanks John,

I'll download the latest Beacon spec.

I'm using both MQTT and UDP (belt and braces for the moment). The UDP always seems to be correct, the MQTT does not, and is missing the RSSI value.

I'll let you know how it goes.

188
mc-Module / Odd beacon Behaviour
« on: August 21, 2016, 10:01:51 am »
I am trying to put data into the 4 beacon bytes available (so I don't have to publish via MQTT so much).

I have found some odd things:

This is my code for publishing beacon data:

Code: [Select]
    //**************************************************************************/
    //*!
    //    Encodes Float or Integer into 4 bytes of beacon data
    //    encoding is - byte 0 is data type (numeric value)
    //    Integer as Short (2 bytes)
    //    Fraction as byte (1 byte)
    //*/
    //**************************************************************************/
    Shared Sub BeaconPublish(data_Type As Byte, value As Object)
        Dim fraction As Byte = 0
        Dim data As Short = 0
        If value Is Float Then
            data = value.Cast(Float).ToShort() //get integer part (16 bit only)
            fraction = ((value.Cast(Float) - data) * 100.0).ToByte()
        ElseIf value Is Integer Then
            data = value.Cast(Integer).ToShort() //get integer part (16 bit only)
        ElseIf value Is Short Then
            data = value.Cast(Short)
        ElseIf value Is Byte Then
            data = value.Cast(Byte).ToShort() //get integer part (16 bit only)
        End If
        Dim beaconData As ListOfByte = New ListOfByte()
        beaconData.Add(data_Type)
        beaconData.AddShort(data)
        beaconData.Add(fraction)
        Lplan.SetBeaconData(beaconData)
        Lplan.SendBeacon()
        //Lplan.BeaconNow () //does not seem to work
    End Sub

This is what I receive and decode. Mostly it works, then sometimes I get the first three bytes repeated in the beacon data, sometimes just second and third (this gives the -17.67 result which is bogus)

Code: [Select]
10:33:59.868 [INFO ] [org.openhab.model.script.error:53   ] - Beacon Bytes:  EF:BF:BD:11:01:00:05:22:00:12:EF:BF:BD:2E:13:01:00:
10:33:59.943 [INFO ] [org.openhab.model.script.error:53   ] - bytes[6] = 5
10:34:01.321 [INFO ] [org.openhab.model.script.error:53   ] - Decoded Bytes:  Humidity 34.18000000 05:22:00:12
10:34:38.226 [INFO ] [org.openhab.model.script.error:53   ] - Beacon Bytes:  EF:BF:BD:11:01:00:08:EF:BF:BD:01:1C:EF:BF:BD:2E:13:01:00:
10:34:38.227 [INFO ] [org.openhab.model.script.error:53   ] - bytes[6] = 8
10:34:38.407 [INFO ] [org.openhab.model.script.error:53   ] - Decoded Bytes:  Altitude -17.67000000 08:EF:BF:BD
10:34:48.637 [INFO ] [org.openhab.model.script.error:53   ] - Beacon Bytes:  EF:BF:BD:11:01:00:01:EF:BF:BD:01:00:EF:BF:BD:2E:13:01:00:
10:34:48.718 [INFO ] [org.openhab.model.script.error:53   ] - bytes[6] = 1
10:34:49.918 [INFO ] [org.openhab.model.script.error:53   ] - Decoded Bytes:  Uptime -17.67000000 01:EF:BF:BD


Also, according to the documentation Lplan.SendBeacon() should accept a ListOfBytes as data - but it doesn't. In fact seems to do nothing.
Lplan.BeaconNow () is Documented, but does not seem to exist.

It would be helpful if we could send 5 bytes - then I could send 1 byte as data type, then 4 bytes as the data (as all numeric types are stored as 4 bytes), instead I have to fit 4 bytes of data into 3. Not a big problem as I'm publishing environmental data, so +/- 32k is plenty for temperature, humidity, pressure etc. Just saying...

Is this behavior a bug?

189
mc-Module / Re: How to do power of calculations
« on: August 19, 2016, 12:53:07 pm »
OK, thanks,

The workaround seems to work.

190
mc-Module / Re: How to do power of calculations
« on: August 19, 2016, 09:38:14 am »
Thanks,

There seems to be something wrong with the Pow function. Here is my code:

Code: [Select]
    Public Function readAltitude(seaLevel As Float) As Float
       
        // Equation taken from BMP180 datasheet (page 16):
       
        // Note that using the equation from wikipedia can give bad results
        // at high altitude.
       
        Dim atmospheric As Float = readPressure()
        Dim factor As Float = atmospheric / seaLevel
        A_factor = factor.Pow(0.1903) // value used for debuging
        Return 44330.0 * (1.0 - (factor.Pow(0.1903)))
    End Function

This gives incorrect values. Checking, I find the factor is correct - for atmospheric at 1000.802795 and sealLevel at 1000.00 the factor is 1.000802795 (correct). If I then raise this to the power of 0.1903 (which is 1/5.255) I get 0.189175 which is not correct - this should be 1.00015 (aprox).

Any idea what is going on here?

Thanks.

191
mc-Module / Re: Problems with I2c configuration
« on: August 18, 2016, 12:23:55 pm »
John,

Tom sent me the binaries (7-365) I just loaded everything and it works ;D

I now have my persistent I2c object functioning for both internal temperature sensor, and external BME280 temp/humid/press sensor.

Thank you!

Now if I can just find out why it keeps running out of memory and resetting....

192
mc-Module / Re: Problems with I2c configuration
« on: August 18, 2016, 10:59:46 am »
Thanks John,

I now have the class working (with your pressure conversion function), so I'll integrate it into the rest of my program, and wait for the fix.

Thanks for the quick feedback.

193
mc-Module / Re: Variables Signed/Unsigned and such
« on: August 18, 2016, 10:54:07 am »
Just FYI,

I now have this module working, with what look like sane values.

Your conversion function does work! it was my errors that were causing weird results. Many Thanks for the effort.

I now have a working class that supports the BME280 temp/humidity/pressure module.

I now need to work on the rest of the program....

194
mc-Module / Re: Problems with I2c configuration
« on: August 17, 2016, 04:08:43 pm »
Not as such,

I'm trying to create a persistent I2C object (persists between timed events). But I can't get it to work.

The object works if you create it in the event. If you create it at boot (or any other time), it doesn't work in Shared Events (resets). I was looking at memory to see what was happening, but maybe got lead astray by the "odd memory behavior".

So ignoring weird memory things, how do you create a shared I2C object, that can be used in a Shared event without having to re-create it every time?

If I re-create it every time, then everything that is stored in the I2c module (calibration factors etc) have to be re-read into local variables each time you want to read the sensor. You also have to set up the resolution, filtering, period, etc. etc.  Not really the point of a class.

I should be able to do this once (when the instance of the class is created as an object (in New)), then just call the readTemperature() method to read the I2C register and calculate the temperature or whatever.

I don't want to have to create a new object every time I want to read anything over I2C.

If I make everything Shared (ie don't use Public/Private at all), and don't create an instance of the object, it works - but then you can only use it for one sensor...

Any Suggestions?

195
mc-Module / Re: Odd Memory Behaviour
« on: August 17, 2016, 02:50:13 pm »
Just had to reboot my computer, made a test program (ie removed my extraneous stuff), and - doesn't do it anymore.

Memory counts down to about 200 bytes, then pause - starts off at 15k again, but no reset.

Can't explain it. I am still trying to get an I2C object to persist between events (with no luck), so maybe something I did there was causing the resets.

I'll let you know if I figure out what is going on.

Pages: 1 ... 11 12 [13] 14 15