marcelpetrick

I want my Wifi-repeater. Now!

Written by  on May 4, 2019

Three weeks ago, while being in the garden, I noticed that there is no network connectivity except by superslow EDGE. Of course, three walls block the Wifi-router, but what about one repeater which is closer and just shielded by one wall? Also I remembered having read about the usage of some ESP-nodes for that. I don’t like the approach of buying some closed-source-product.

Short research yielded the project from martin-ger on Github, which I wanted to use. I was surprised that nothing for the ESP32 is available (only for ESP8266). So I tracked down my single ESP8266 (LoLin, NodeMCU, not sure which revision, but with CH340G-USB-connect and as DevKit (mingling with pulldown-resitors would add another layer of complexity, which I am not sure I want to tackle).
Turns out I could not flash the given item properly with the ESP8266 Download Tool 3.65. It blinks while doing so, but follow-up seral-monitoring onyl yields “lolin ts Jan 8 2013,rst cause:2, boot mode:(3,6)”.

So I ordered a from a german shop a new ESP8266. Looks like exactly the same model.
Will do some quicktest now with the blink-app (basic functionality and flashing works?). And then do a test with the ESP Download tool.

More later ..

Advanced debugging: find call which triggers Qt-errors

Written by  on April 26, 2019

Currently the debugging version of the Qt-libraries is not available. But I receive a report "QIODevice::write (QIODevice): Called with maxSize < 0" deep within them.
Our codebase is quite large, I am more familiar with other sections and let's say it: some is 'legacy'. So, where to start looking?!?
Yesterday I remembered a trick to get via call-stack to the last-recent position where our functions trigger that mistake.

Inserted in the main.cpp after show from the MainWindow was called a

which stands for this

Add a breakpoint in the messageHandler and debug the app. Maybe disable the breakpoint until you start to trigger the critical functionality.
When it breaks, you have a nice callstack and can backtrace where it came from :)

how to resume broken downloads

Written by  on April 24, 2019

aka: fix the weird firewalling settings ..
aka: How to download the latest stable Qt SDK source code?
curl -L -O -C - http://download.qt.io/official_releases/qt/5.12/5.12.3/single/qt-everywhere-src-5.12.3.zip

cmd replacement: cmder

Written by  on March 29, 2019

Sometimes you have to call some batch-files with spoecific windows-tools, so a bash is not helpful on Win.
A colleague recommended cmdr, which is quite nice and fine.
Suits my needs 🙂

ESP32: integrated the YL-69 for moisture-metering, also fried my first BME280

Written by  on March 12, 2019

Acquired a Bosch BME280 for improved humidity, air pressure and temperature-measurement (DHT22 can’t read barometric pressure) and tried to attach it via I2C.
Let’s keep it short: the sensor got very hot after several tries to find the correct wiring. Even using the i2c-scanner testprogram did not yield any results. But I learned how to use the breadboard more effectively. The burnt IC will be sold as ‘Lehrgeld’ 😉 (Oh, the days when I fried my AMD Duron, because I thought that a CPU won’t heat up so fast at boot. Boy was I wrong.)
Integrated then at least via analog reading the YL-69 moisture sensor. Worked well and on first try. Guess I just need to read much, much .. more about I2C, wiring and the sensors.
Another lesson learned: if you want to see really badly structured, basic coding: check tutorials for microcontrollers :/ (especially mine ;))
———
Code is committed and pushed to github.
Output is something like:

breadboard-setting featuring a Haworthia and WerNO!:

SmartGit can process warnings from commit-hooks!

Written by  on March 8, 2019

Another thing I was not aware of: SmartGit can present warnings reported from (pre-)commit-hooks in an alerting way.
Just add echo “warning:” as prefix to your message and it will result in a warning signpost and a modal dialog after commit.

I’ve filed a change-request to make this parsing of the messages case-insensitive.

Move some feature-implementation with Git-help from one branch to another without previous “merges”

Written by  on March 8, 2019

We ran at work into the quite tricky problem to move the “pure” implementation of a feature to some other branch (a quickfix-release) without adding those features/bugfixes from the current master-branch. The feature branch was created some while ago and meanwhile updated from time to time with origin/master.

Discussed options were:
* manually copy the changes (since it was one directory and some minor adjustments in other CMakeLists.txts and some calls) –> much work, very error prone in terms of “Oh, I missed something”
* move to HEAD@target-branch and cherry-pick one-by-one all feature-commits (without merge-commits) –> lots of work, because 15+ commits
* some Git-way –> preferred by me, but I neve did something similar before – so: totally unknown

I chose the third option and tinkered in parallel while someone else tried the other path.
0. created “fake-feature-branch” on HEAD of the feature-branch
1. merged current state master-branch to it
2. created a diff as patch-file between HEAD@master and HEAD@”fake-feature-branch” by:
git diff fromHash toHash --binary > ../binary.patch
(–binary is important; else added ressources will be missing)
4. switch to HEAD@targetBranch
5. apply the patch (and suppress whitespace-errors) by:
git apply --whitespace=fix ../binary.patch
6. eventually fix conflicts if necessary

Yay, two commands to save the day! Around 170 files were affected, so manually doing the application of the changes was out of scope for me. There had to be a feasible Git-solution.

ESP32 and DHT22: temperature and humdity

Written by  on March 5, 2019

To give my (non-existant) skills for microcontrollers and reading out sensor-values a kick-start, I decided to connect today an DHT11 to the ESP32.
So, at first I realized I have no clue how a breadboard works, then that I need a calculator to determine the resistors properly, then “how to determine the correct pin-numbering”, then … it did not work, no matter what I tried. The C++-code was the least issue. Several sources provide examples, also with webserver (looks like everyone ~stole~ got inspired from each other ..), but the read-out always failed.
Luckily I had two (a bit more ‘expensive) DHT22 at hand and it worked like a charm!

Lessons learned: 0. accept that you know nothing 1. reading and experimenting is fun 2. seeing finally a presentable result is great <3

Result:
* code
* output:

advanced whitespace-correction

Written by  on February 26, 2019

(for CMake/C++-projects)

Find all fitting files and run the fixer-script in parallel over it.

After playing for a while with sed and awk and not being able to get a fitting solution, I decided to create my own as python-script. It squashes all consecutive double-whitespace-lines (and adds one to the end if missing).

Or “run it on the files changed for the last commit”:

Sources:
removeTrainling.sh
squashMultipleWhitespace.py

How to get GNU parallel (developed by Ole Tange):

Updating to the current package of Qt Charts (from the commercial version)

Written by  on February 1, 2019

Qt (or Digia? or how was the company-owning-Qt called at that time?) released in 2014 the version 1.4 of their Charts add-on for Qt. It was available only for the commercial-license and had some distinc namespace-requirements. And was also quite bare-metal.
Further development lead to more opportunities regarding the emitted signals for the cursor-handling (pressed/released instead of just clicked, for instance) and it became part of the regular package for Qt.

## Advice for a CMake-based project ##

If you want to maintain and upgrade your legacy code, then:

  1. add “Charts” to your find_package:
  2. change the namespace inside the CMakeLists from “former naming” to “Qt5::Charts”
  3. remove the dependency to the old package in the top-level CMakeLists.txt
  4. replace inside the h/cpp all occurences of “QtCommercialChart::” with “QtCharts::”
  5. replace inside the h/cpp all occurences of “QTCOMMERCIALCHART_USE_NAMESPACE” with “using namespace QtCharts;”
  6. update the installer-creator-script(s) to include the Qt5Charts.dll

Et voilà , it should build now.