Compare commits

...

4 Commits

Author SHA1 Message Date
Miles Raymond
5687a22c4f
Merge 90446b31b0 into 78d6e5931c 2026-02-03 17:16:49 -05:00
Jake Kenneally
78d6e5931c
fix: Correct debugging_monitor.py script instructions (#676)
Some checks are pending
CI / build (push) Waiting to run
## Summary

**What is the goal of this PR?**
- Minor correction to the `debugging_monitor.py` script instructions

**What changes are included?**
- `pyserial` should be installed, NOT `serial`, which is a [different
lib](https://pypi.org/project/serial/)
- Added macOS serial port

## Additional Context

- Just a minor docs update. I can confirm the debugging script is
working great on macOS

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**< NO >**_
2026-02-04 00:33:20 +03:00
Luke Stein
dac11c3fdd
fix: Correct instruction text to match actual button text (#672)
## Summary

* Instruction text says "Press OK to scan again" but button label is
actually "Connect" (not OK)
* Corrects instruction text

---

### AI Usage

Did you use AI tools to help write this code? **No**
2026-02-04 00:32:52 +03:00
Miles Raymond
90446b31b0 add unique hostname support 2026-02-02 13:08:53 -08:00
4 changed files with 44 additions and 13 deletions

View File

@ -102,13 +102,18 @@ After flashing the new features, its recommended to capture detailed logs fro
First, make sure all required Python packages are installed:
```python
python3 -m pip install serial colorama matplotlib
python3 -m pip install pyserial colorama matplotlib
```
after that run the script:
```sh
# For Linux
# This was tested on Debian and should work on most Linux systems.
python3 scripts/debugging_monitor.py
# For macOS
python3 scripts/debugging_monitor.py /dev/cu.usbmodem2101
```
This was tested on Debian and should work on most Linux systems. Minor adjustments may be required for Windows or macOS.
Minor adjustments may be required for Windows.
## Internals

View File

@ -11,7 +11,19 @@
#include "fontIds.h"
namespace {
constexpr const char* HOSTNAME = "crosspoint";
// Generate hostname dynamically based on device MAC address
String getDeviceHostname() {
static String deviceHostname;
if (deviceHostname.length() == 0) {
uint64_t chipId = ESP.getEfuseMac();
// Extract last 6 hex digits (24 bits) for serial number
uint32_t serialNum = (uint32_t)(chipId & 0xFFFFFF);
char hostname[32];
snprintf(hostname, sizeof(hostname), "XTeinkX4-%06X", serialNum);
deviceHostname = String(hostname);
}
return deviceHostname;
}
} // namespace
void CalibreConnectActivity::taskTrampoline(void* param) {
@ -94,9 +106,9 @@ void CalibreConnectActivity::startWebServer() {
state = CalibreConnectState::SERVER_STARTING;
updateRequired = true;
if (MDNS.begin(HOSTNAME)) {
if (MDNS.begin(getDeviceHostname().c_str())) {
// mDNS is optional for the Calibre plugin but still helpful for users.
Serial.printf("[%lu] [CAL] mDNS started: http://%s.local/\n", millis(), HOSTNAME);
Serial.printf("[%lu] [CAL] mDNS started: http://%s.local/\n", millis(), getDeviceHostname().c_str());
}
webServer.reset(new CrossPointWebServer());

View File

@ -19,10 +19,24 @@ namespace {
// AP Mode configuration
constexpr const char* AP_SSID = "CrossPoint-Reader";
constexpr const char* AP_PASSWORD = nullptr; // Open network for ease of use
constexpr const char* AP_HOSTNAME = "crosspoint";
constexpr uint8_t AP_CHANNEL = 1;
constexpr uint8_t AP_MAX_CONNECTIONS = 4;
// Static cached hostname for the device
static String deviceHostname;
// Generate hostname dynamically based on device MAC address
String getDeviceHostname() {
if (deviceHostname.length() == 0) {
// Extract last 6 hex digits (24 bits) for serial number
uint32_t serialNum = (uint32_t)(ESP.getEfuseMac() & 0xFFFFFF);
char hostname[32];
snprintf(hostname, sizeof(hostname), "XTeinkX4-%06X", serialNum);
deviceHostname = String(hostname);
}
return deviceHostname;
}
// DNS server for captive portal (redirects all DNS queries to our IP)
DNSServer* dnsServer = nullptr;
constexpr uint16_t DNS_PORT = 53;
@ -181,8 +195,8 @@ void CrossPointWebServerActivity::onWifiSelectionComplete(const bool connected)
exitActivity();
// Start mDNS for hostname resolution
if (MDNS.begin(AP_HOSTNAME)) {
Serial.printf("[%lu] [WEBACT] mDNS started: http://%s.local/\n", millis(), AP_HOSTNAME);
if (MDNS.begin(getDeviceHostname().c_str())) {
Serial.printf("[%lu] [WEBACT] mDNS started: http://%s.local/\n", millis(), getDeviceHostname().c_str());
}
// Start the web server
@ -234,8 +248,8 @@ void CrossPointWebServerActivity::startAccessPoint() {
Serial.printf("[%lu] [WEBACT] IP: %s\n", millis(), connectedIP.c_str());
// Start mDNS for hostname resolution
if (MDNS.begin(AP_HOSTNAME)) {
Serial.printf("[%lu] [WEBACT] mDNS started: http://%s.local/\n", millis(), AP_HOSTNAME);
if (MDNS.begin(getDeviceHostname().c_str())) {
Serial.printf("[%lu] [WEBACT] mDNS started: http://%s.local/\n", millis(), getDeviceHostname().c_str());
} else {
Serial.printf("[%lu] [WEBACT] WARNING: mDNS failed to start\n", millis());
}
@ -439,7 +453,7 @@ void CrossPointWebServerActivity::renderServerRunning() const {
startY += 6 * 29 + 3 * LINE_SPACING;
// Show primary URL (hostname)
std::string hostnameUrl = std::string("http://") + AP_HOSTNAME + ".local/";
std::string hostnameUrl = std::string("http://") + getDeviceHostname().c_str() + ".local/";
renderer.drawCenteredText(UI_10_FONT_ID, startY + LINE_SPACING * 3, hostnameUrl.c_str(), true, EpdFontFamily::BOLD);
// Show IP address as fallback
@ -468,7 +482,7 @@ void CrossPointWebServerActivity::renderServerRunning() const {
renderer.drawCenteredText(UI_10_FONT_ID, startY + LINE_SPACING * 2, webInfo.c_str(), true, EpdFontFamily::BOLD);
// Also show hostname URL
std::string hostnameUrl = std::string("or http://") + AP_HOSTNAME + ".local/";
std::string hostnameUrl = std::string("or http://") + getDeviceHostname().c_str() + ".local/";
renderer.drawCenteredText(SMALL_FONT_ID, startY + LINE_SPACING * 3, hostnameUrl.c_str());
renderer.drawCenteredText(SMALL_FONT_ID, startY + LINE_SPACING * 4, "Open this URL in your browser");

View File

@ -520,7 +520,7 @@ void WifiSelectionActivity::renderNetworkList() const {
const auto height = renderer.getLineHeight(UI_10_FONT_ID);
const auto top = (pageHeight - height) / 2;
renderer.drawCenteredText(UI_10_FONT_ID, top, "No networks found");
renderer.drawCenteredText(SMALL_FONT_ID, top + height + 10, "Press OK to scan again");
renderer.drawCenteredText(SMALL_FONT_ID, top + height + 10, "Press Connect to scan again");
} else {
// Calculate how many networks we can display
constexpr int startY = 60;