Firmware update

Started by fizzyade, August 13, 2021, 07:06:45 PM

fizzyade

Hi,

I'm trying to update my current ranger, I bought it a couple of weeks back from electron and double-pressing the power button doesn't appear to do much, it doesn't seem to go into any kind of bootloader, the OLED display indicates it's just running as normal.

Does my unit have old firmware without this ability? (I thought it would be up to date given how I only bought the unit now). Upon boot, it's showing firmware 1.0.0

Edit: I took it out of the box and the PCB says CurrentRanger R3 mk5, so as far as I can tell, this should support the firmware update described in your information.

I'm trying to update because I fitted the buzzer, and the thing beeping on me on auto range changes is driving me crazy, I'd say that the current behaviour is not what people would generally want, the light and/or display changes are sufficient.

The values displayed on the OLED are the values I need to keep?

//#define ADC_CALIBRATE_FORCED
#define ADC_CALIBRATE_FORCED_OFFSET 0
#define ADC_CALIBRATE_FORCED_GAIN   2046
#define LDO_DEFAULT                 3.299 //volts, change to actual LDO output (measure GND-3V on OLED header)


I've plonked those values into these variables, is that all I need to do?

Thanks


fizzyade

Ok, I figured it out, I think the section on the website needs a bit more information.

1.) It's not the button on the front that you use to turn the device on/off that you need to press, it's a button on the back, this is obviously my fault, I just assumed it as the button on the front, I don't even remember seeing the button on the back and I soldered the UART header in a couple of hours ago and still didn't see it.

2.) The actual conversion of the firmware to a uf2 file and a note saying that you need to drag the file into the device, you can name it <anything>.uf2. 

3.) Adding the uf2 python tool to your repo (license permitting, or as a submodule) and providing a script that converts the firmware to the necessary format.

I'm now up and running with the new firmware and no more beeps on the auto range change! Yay!

It's a fantastic product, I've just discovered the joy of the esp32 as a battery-powered device (it also has a very good native SDK, I tried micropython and it felt clunky as hell and I only did that because I thought the SDK would be a nightmare, but it actually turned out to be a doddle and very easy to use!)




Thanks

Felix

fizzyade - thanks for the suggestions.
I made the changes. On #1 I believe that is clear enough, only 1 such button on the board, there is more than 1 mention of the "RST button" and RST pads, and how to enter the bootloader.

fizzyade

Quote from: Felix on August 16, 2021, 12:23:19 PM
fizzyade - thanks for the suggestions.
I made the changes. On #1 I believe that is clear enough, only 1 such button on the board, there is more than 1 mention of the "RST button" and RST pads, and how to enter the bootloader.

Yeah, I just missed it, I didn't spot the switch on the back when I was soldering in the header.

Even though the instructions say reset, my brain just kept linking the power button with reset, so I sat there for 30 minutes trying to figure out why I couldn't get into flash mode, this was probably in part because I had fixed the board into the case.

With the reset button being on the opposite side of the board it's easy to make the incorrect association, I just expected reset to be accessible on an assembled unit.

I may be the only person whose brain ever does this, but I figured it was worth mentioning.

Regardless, I'm up and running now and loving the unit.  I'm about to set up a test with logging via USB (and an isolator) to get a super detailed history of a 24 hour period.  The device itself has impressed me thus far, we have a keithley meter in the office, but I work from home and can remotely interact with equipment on my desk (even if it involves me getting a human to twiddle buttons!), but having access to measurements like this is useful both for business and my own personal projects.

I've actually also reverted the display code back so that it shows the 'A' as I think it looks better, although I guess you probably dropped it for aesthetic reasons (the top of the A gets chopped.

I'm really grateful that you have released the code to allow us to tweak stuff like this, I wanted the speaker but I was seeing a reasonable amount of range changes between uA and nA and the beeping was a little too much, especially when I'm coding at night and not wanting to wake my wife.

Also, the European distributor was fantastic, the device arrived quickly and no issues with the parcel making its way from mainland Europe (and the EU) to the UK, I didn't realise at the time, but I've bought brymen meters from them in the past as well.

I'm going to take a look now to see if there are any slightly bigger OLED displays that would allow me to slightly tweak the display, possibly adding min, max, avg to be displayed as well.

Felix

I forgot to mention you can enter the bottloader by sending a 'r'+ENTER in the serial console (recent firmware). Then you don't need to access the RST button. I added this detail as well now.

Not sure about bigger OLEDs. I looked at a lot of options including TFTs etc. The bigger it is the more data processing and transmission is required. This OLED is well supported by libraries, easy to use, not too expensive, very portable, and can display quite a bit of info in the 128x64 area, various smaller fonts are available, I just used whatever was more common sense. The more you change on the display the more time it spends on drawing that to the display memory which takes from USB logging speed. But if you're attaching the OLED then it's assumed you're using that and not USB logging. If you start the unit without the OLED and it doesn't detect it, then it won't spend any time writing to it so USB logging speed will be faster.

fizzyade

#5
Yeah, I looked after I posted that and came to the same conclusion.

However, I'm considering using a Pi Zero-W and use a display on that with it connected to the ranger and create an enclosure to hold it all.

I have a very basic python script I quickly knocked together that takes the data feed via USB and displays the useful info for me.

A useful feature for USB would be to handle ESC which would return the unit to the main menu, exiting out of any mode it's currently in, it doesn't appear to do that at the moment, I connect to the ranger and then check if I can read a line, if I can then I'm probably in the data mode, if I don't then I'm probably in the main menu, so can send the appropriate command to enter it.

I know I could just send 'u' anyway and it wouldn't matter, but I think the handling of ESC would be a good function to have. 


I realised just now that sending u again changes the mode with feedback, so it's easy to detect!

Felix

There is no "data mode" or context implemented. Maybe you're referring to a way to reset it to power-on state where there is no logging.
Otherwise there are various features that if implemented, can be toggled on/off. See the serial menu for details.

fizzyade

All good, when I said data mode I meant logging mode.

Anyway, here's my quick hacky python script, it may be useful for other folks.

https://gist.github.com/fizzyade/08a5803a6d9c50dad53c613b2f82abf9