diff --git a/examples/meshtastic/cpp/android.cpp b/examples/meshtastic/cpp/android.cpp index 8447e07..3be00e2 100644 --- a/examples/meshtastic/cpp/android.cpp +++ b/examples/meshtastic/cpp/android.cpp @@ -32,7 +32,9 @@ QVariant QT::keepScreenOn(const QVariant& on) { if (window.isValid()) { const int FLAG_KEEP_SCREEN_ON = 128; const char* method = on.toBool() ? "addFlags" : "clearFlags"; - window.callMethod(method, "(I)V", FLAG_KEEP_SCREEN_ON); + window.callMethod( + method, + "(I)V", FLAG_KEEP_SCREEN_ON); } } clearEventualExceptions(); @@ -45,7 +47,9 @@ QVariant QT::keepScreenOn(const QVariant& on) { if (window.isValid()) { const int FLAG_KEEP_SCREEN_ON = 128; const char* method = on.toBool() ? "addFlags" : "clearFlags"; - window.callMethod(method, "(I)V", FLAG_KEEP_SCREEN_ON); + window.callMethod( + method, + "(I)V", FLAG_KEEP_SCREEN_ON); } } clearEventualExceptions(); @@ -78,13 +82,17 @@ QVariant QT::iniPositioning() { #if (QT_VERSION < 0x060000) QtAndroid::runOnAndroidThread([] { QAndroidJniObject activity = QtAndroid::androidActivity(); - activity.callMethod("iniLocation", "()V"); + activity.callMethod( + "iniLocation", + "()V"); clearEventualExceptions(); }); #else QNativeInterface::QAndroidApplication::runOnAndroidMainThread([&] { QJniObject activity = QtAndroidPrivate::activity(); - activity.callMethod("iniLocation", "()V"); + activity.callMethod( + "iniLocation", + "()V"); clearEventualExceptions(); }); #endif diff --git a/examples/meshtastic/cpp/connection/usb/usb_me.android.cpp b/examples/meshtastic/cpp/connection/usb/usb_me.android.cpp index ba49dc6..e9ce8d1 100644 --- a/examples/meshtastic/cpp/connection/usb/usb_me.android.cpp +++ b/examples/meshtastic/cpp/connection/usb/usb_me.android.cpp @@ -13,6 +13,10 @@ USB_ME* USB_ME::_this = nullptr; +static USB_ME* instance() { + return USB_ME::_this; +} + static void clearEventualExceptions() { #if (QT_VERSION < 0x060000) QAndroidJniEnvironment env; @@ -26,15 +30,19 @@ static void clearEventualExceptions() { static void javaSetReady(JNIEnv*, jobject, jboolean jb) { // see Java bool ready = (bool)jb; - USB_ME::_this->ready = ready; - USB_ME::_this->emitter->setReady(QVariant(QVariantList() << ready)); + instance()->ready = ready; + instance()->emitter->setReady(QVariant(QVariantList() << ready)); } static void javaOnNewData(JNIEnv* env, jobject, jbyteArray jba) { // see Java jbyte* jb = env->GetByteArrayElements(jba, NULL); jsize js = env->GetArrayLength(jba); QByteArray ba((char*)jb, js); - QMetaObject::invokeMethod(USB_ME::_this, "onNewData", Q_ARG(QByteArray, ba)); + // run on Qt thread + QMetaObject::invokeMethod( + instance(), + "onNewData", + Q_ARG(QByteArray, ba)); env->ReleaseByteArrayElements(jba, jb, JNI_ABORT); clearEventualExceptions(); } @@ -69,7 +77,9 @@ void USB_ME::connectToRadio() { #else QJniObject service = QtAndroidPrivate::service(); #endif - service.callMethod("iniUsb", "()V"); + service.callMethod( + "iniUsb", + "()V"); clearEventualExceptions(); } @@ -91,7 +101,9 @@ void USB_ME::write2(const QByteArray& ba) { #else QJniObject service = QtAndroidPrivate::service(); #endif - service.callMethod("writeUsb", "([B)V", jba); + service.callMethod( + "writeUsb", + "([B)V", jba); clearEventualExceptions(); } else { qDebug() << "USB not ready: write()"; diff --git a/examples/meshtastic/cpp/connection/usb/usb_me.cpp b/examples/meshtastic/cpp/connection/usb/usb_me.cpp index 5c3e4aa..d228a54 100644 --- a/examples/meshtastic/cpp/connection/usb/usb_me.cpp +++ b/examples/meshtastic/cpp/connection/usb/usb_me.cpp @@ -28,14 +28,18 @@ void USB_ME::connectToRadio() { } const auto infos = QSerialPortInfo::availablePorts(); - // tested with HELTEC V3, LILYGO T-Beam, RAK 4631 + // tested with HELTEC v3, LILYGO T-Beam, RAK 4631 const QStringList supported = { "RAK", "UART", "USB" }; for (auto info : infos) { QString name(info.manufacturer() + " | " + info.description()); QString port(info.portName()); +#ifdef Q_OS_UNIX if (port.startsWith("tty") && (port.contains("ACM", Qt::CaseInsensitive) || // Linux port.contains("USB", Qt::CaseInsensitive))) { // macOS +#else + if (port.startsWith("COM", Qt::CaseInsensitive)) { // Windows +#endif for (auto s : supported) { if (name.contains(s, Qt::CaseInsensitive)) { setPortName(info.portName()); diff --git a/examples/meshtastic/hardware/img/worst-antenna.jpg b/examples/meshtastic/hardware/img/worst-antenna.jpg new file mode 100644 index 0000000..402f6bd Binary files /dev/null and b/examples/meshtastic/hardware/img/worst-antenna.jpg differ diff --git a/examples/meshtastic/hardware/img/worst-antennas.jpg b/examples/meshtastic/hardware/img/worst-antennas.jpg deleted file mode 100644 index c91332a..0000000 Binary files a/examples/meshtastic/hardware/img/worst-antennas.jpg and /dev/null differ diff --git a/examples/meshtastic/hardware/radio.htm b/examples/meshtastic/hardware/radio.htm index 2a11d0a..ae70704 100644 --- a/examples/meshtastic/hardware/radio.htm +++ b/examples/meshtastic/hardware/radio.htm @@ -70,11 +70,10 @@ It's highly recommended to only trust specialized shops (Mouser, Rokland, RAK store) for antennas, because there is simply too much mass produced garbage out there (talking from experience).

- If an antenna is totally off when I measure it, I like to dissect it. -
Here you can see the inside of one good example, and the worst offenders so far (at the outside all share the exact same length of around 20cm and the exact same shape, see cut off plastic part on the left): + Here you can see the inside of one good example, and the worst offender so far:

- +

Here an example of a classical (home made) ground plane antenna, using an SMA socket and 2 mm copper wire, after calculating the lengths here: