Skip to content

Commit d22d93f

Browse files
matteocrippaMatteo Crippa
andauthored
V/0.0.14 (#34)
* bump build * introduce reset connection handler * skipe enqueue for 1 core devices * add auto update flag * updated security * show ip, mac * add configuration debug print * add chip info * new release script * updated readme * updated script * updates --------- Co-authored-by: Matteo Crippa <matteocrippa@github.users.com>
1 parent d0cc742 commit d22d93f

File tree

14 files changed

+119
-19
lines changed

14 files changed

+119
-19
lines changed

.github/workflows/release.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,22 @@ jobs:
4646
- name: Archive Artifacts
4747
run: |
4848
mkdir -p artifacts
49-
find .pio/build -name "firmware.bin" -exec sh -c 'cp "{}" "artifacts/firmware_$(basename $(dirname {})).bin"' \;
50-
find .pio/build -name "bootloader.bin" -exec sh -c 'cp "{}" "artifacts/bootloader_$(basename $(dirname {})).bin"' \;
51-
find .pio/build -name "partitions.bin" -exec sh -c 'cp "{}" "artifacts/partitions_$(basename $(dirname {})).bin"' \;
49+
# Define the mapping of board names to file prefixes
50+
declare -A board_map=(
51+
["esp8266"]="0x0000_firmware"
52+
["geekmagic-smalltv"]="0x0000_firmware"
53+
["esp32"]="0x10000_firmware 0x1000_bootloader 0x8000_partitions"
54+
["esp32-s2"]="0x10000_firmware 0x1000_bootloader 0x8000_partitions"
55+
["esp32-s3"]="0x10000_firmware 0x1000_bootloader 0x8000_partitions"
56+
["lilygo-t-display-s3"]="0x10000_firmware 0x1000_bootloader 0x8000_partitions"
57+
)
58+
59+
# Iterate through each board and copy corresponding files
60+
for board in "${!board_map[@]}"; do
61+
for file_type in ${board_map[$board]}; do
62+
find .pio/build -name "${file_type}.bin" -exec sh -c 'cp "{}" "artifacts/'"${board_map[$board]}"'_$(basename $(dirname {})).bin"' \;
63+
done
64+
done
5265
working-directory: ${{ github.workspace }}
5366

5467
- name: Upload Artifacts

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
# v0.0.13
1+
# v0.0.14
22

33
- Investigated issue with reboot on ESP8266
4+
- Add support for disable auto update to WebUI
5+
- Fix WebUI bug for blinking
6+
- Add new build script with address to write the binaries
7+
- Updated readme

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,16 @@ _Legend_
5757

5858
| Board | Link |
5959
| :------------------------------------------------------- | :----------------------------------------------------------- |
60-
| [ESP8266](https://s.click.aliexpress.com/e/_EuwffHJ) | [0.0.13](https://github.com/matteocrippa/leafminer/releases) |
61-
| [GeekMagic SmartTV]() | [0.0.13](https://github.com/matteocrippa/leafminer/releases) |
62-
| [ESP32](https://s.click.aliexpress.com/e/_Ey6AJnT) | [0.0.13](https://github.com/matteocrippa/leafminer/releases) |
63-
| [ESP32-S2](https://s.click.aliexpress.com/e/_EGJcibR) | [0.0.13](https://github.com/matteocrippa/leafminer/releases) |
64-
| [ESP32-S3](https://s.click.aliexpress.com/e/_EJbAXyl) | [0.0.13](https://github.com/matteocrippa/leafminer/releases) |
65-
| [LILYGO-T-S3](https://s.click.aliexpress.com/e/_ExRWk6H) | [0.0.13](https://github.com/matteocrippa/leafminer/releases) |
66-
67-
- Browse to [ESPWebtool](https://esp.huhn.me/) using a Chrome based browser and follow the instructions.
60+
| [ESP8266](https://s.click.aliexpress.com/e/_EuwffHJ) | [0.0.14](https://github.com/matteocrippa/leafminer/releases) |
61+
| [GeekMagic SmartTV]() | [0.0.14](https://github.com/matteocrippa/leafminer/releases) |
62+
| [ESP32](https://s.click.aliexpress.com/e/_Ey6AJnT) | [0.0.14](https://github.com/matteocrippa/leafminer/releases) |
63+
| [ESP32-S2](https://s.click.aliexpress.com/e/_EGJcibR) | [0.0.14](https://github.com/matteocrippa/leafminer/releases) |
64+
| [ESP32-S3](https://s.click.aliexpress.com/e/_EJbAXyl) | [0.0.14](https://github.com/matteocrippa/leafminer/releases) |
65+
| [LILYGO-T-S3](https://s.click.aliexpress.com/e/_ExRWk6H) | [0.0.14](https://github.com/matteocrippa/leafminer/releases) |
66+
67+
- Browse to [ESPWebtool](https://esp.huhn.me/) using a Chrome based browser and upload the file according to the address in the file name.
68+
69+
For example this is how ESP32-S3 will look like:
6870

6971
<img width="687" alt="LeafMiner Web flash" src="https://github.com/matteocrippa/leafminer/assets/475463/f483b8fe-a563-4249-98f8-092a45a9b4f8">
7072

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
The following versions of LeafMiner are currently supported with security updates:
66

7-
- 0.0.8
7+
- 0.0.14
88

99
## Reporting a Vulnerability
1010

src/current.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,16 @@ void current_setJob(const Notification &notification)
7878
l_debug(TAG_CURRENT, "Job: %s is cleaned and replaced with %s", current_job->job_id.c_str(), notification.job_id.c_str());
7979
}
8080
}
81+
8182
if (current_job_is_valid == 1)
8283
{
84+
#if CORES > 1
8385
current_job_next = new Job(notification, *current_subscribe, current_difficulty);
8486
l_info(TAG_CURRENT, "Job: %s queued", current_job_next->job_id.c_str());
87+
#endif
8588
return;
8689
}
90+
8791
current_job = new Job(notification, *current_subscribe, current_difficulty);
8892
current_job_is_valid = 1;
8993
l_info(TAG_CURRENT, "Job: %s ready to be mined", current_job->job_id.c_str());
@@ -127,6 +131,14 @@ const char *current_getUptime()
127131
return uptimeString;
128132
}
129133

134+
/**
135+
* @brief Resets the current session by setting the current_subscribe pointer to nullptr.
136+
*/
137+
void current_resetSession()
138+
{
139+
current_subscribe = nullptr;
140+
}
141+
130142
/**
131143
* Sets the Subscribe object for the Current class.
132144
*

src/current.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const char *current_getJobId();
1717
const char *current_getUptime();
1818
void current_setSubscribe(Subscribe *subscribe);
1919
const char *current_getSessionId();
20+
void current_resetSession();
2021
void current_setDifficulty(double difficulty);
2122
const double current_getDifficulty();
2223
void current_increment_block_found();

src/html/setup.html

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,37 @@ <h1>LeafMiner</h1>
7676
<label>Pool Port:</label>
7777
<input type="number" name="pool_port" value="{{pool_port}}" />
7878
<br />
79+
<label>Auto Update:</label>
80+
Off
81+
<input
82+
type="radio"
83+
id="auto_update_off"
84+
name="auto_update"
85+
value="off"
86+
{{auto_update_off}}
87+
/>
88+
On
89+
<input
90+
type="radio"
91+
id="auto_update_on"
92+
name="auto_update"
93+
value="on"
94+
{{auto_update_on}}
95+
/>
96+
<br />
7997
<label>Blinking Enabled:</label>
8098
Off
8199
<input
82100
type="radio"
83-
id="lcd_on_start_off"
101+
id="blink_enabled_off"
84102
name="blink_enabled"
85103
value="off"
86104
{{blink_enabled_off}}
87105
/>
88106
On
89107
<input
90108
type="radio"
91-
id="lcd_on_start_on"
109+
id="blink_enabled_on"
92110
name="blink_enabled"
93111
value="on"
94112
{{blink_enabled_on}}

src/leafminer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef LEAFMINER_H
22
#define LEAFMINER_H
33

4-
#define _VERSION "0.0.13"
4+
#define _VERSION "0.0.14"
55
#define DIFFICULTY 1e-4
66

77
// Mining

src/main.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,19 @@ void setup()
3131
Serial.begin(115200);
3232
delay(1500);
3333
l_info(TAG_MAIN, "LeafMiner - v.%s - (C: %d)", _VERSION, CORE);
34+
l_info(TAG_MAIN, "Compiled: %s %s", __DATE__, __TIME__);
35+
l_info(TAG_MAIN, "Free memory: %d", ESP.getFreeHeap());
36+
#if defined(ESP32)
37+
l_info(TAG_MAIN, "Chip Model: %s - Rev: %d", ESP.getChipModel(), ESP.getChipRevision());
38+
uint32_t chipID = 0;
39+
for (int i = 0; i < 17; i = i + 8)
40+
{
41+
chipID |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
42+
}
43+
l_info(TAG_MAIN, "Chip ID: %s", chipID);
44+
#else
45+
l_info(TAG_MAIN, "Chip ID: %s", ESP.getChipId());
46+
#endif
3447

3548
#if defined(ESP8266)
3649
l_info(TAG_MAIN, "ESP8266 - Disable WDT");
@@ -46,6 +59,7 @@ void setup()
4659
force_ap = button_setup();
4760

4861
storage_load(&configuration);
62+
configuration.print();
4963

5064
if (configuration.wifi_ssid == "" || force_ap)
5165
{
@@ -70,7 +84,10 @@ void setup()
7084
screen_setup();
7185
#endif // HAS_LCD
7286

73-
autoupdate();
87+
if (configuration.auto_update == "on")
88+
{
89+
autoupdate();
90+
}
7491

7592
if (network_getJob() == -1)
7693
{

src/model/configuration.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include <string>
55
#include <stdio.h>
6+
#include "utils/log.h"
67

78
struct Configuration
89
{
@@ -16,6 +17,22 @@ struct Configuration
1617
int blink_brightness = 256;
1718
std::string lcd_on_start = "";
1819
std::string miner_type = "";
20+
std::string auto_update = "";
21+
22+
void print()
23+
{
24+
l_info("wifi_ssid: %s", wifi_ssid.c_str());
25+
l_info("wifi_password: %s", wifi_password.c_str());
26+
l_info("wallet_address: %s", wallet_address.c_str());
27+
l_info("pool_password: %s", pool_password.c_str());
28+
l_info("pool_url: %s", pool_url.c_str());
29+
l_info("pool_port: %d", std::to_string(pool_port).c_str());
30+
l_info("blink_enabled: %s", blink_enabled.c_str());
31+
l_info("blink_brightness: %s", std::to_string(blink_brightness).c_str());
32+
l_info("lcd_on_start: %s", lcd_on_start.c_str());
33+
l_info("miner_type: %s", miner_type.c_str());
34+
l_info("auto_update: %s", auto_update.c_str());
35+
}
1936
};
2037

2138
#endif

0 commit comments

Comments
 (0)