mirror of
https://github.com/skot/ESP-Miner.git
synced 2025-03-17 13:22:53 +01:00
Compare commits
5 Commits
585d83f9d1
...
75243a2cca
Author | SHA1 | Date | |
---|---|---|---|
|
75243a2cca | ||
|
9d8198a4bb | ||
|
1820153c41 | ||
|
e48e9e6bb6 | ||
|
427dda16d3 |
@ -26,11 +26,17 @@
|
||||
|
||||
static const char * TAG = "display";
|
||||
|
||||
static esp_lcd_panel_handle_t panel_handle = NULL;
|
||||
static bool display_state_on = false;
|
||||
|
||||
static lv_theme_t theme;
|
||||
static lv_style_t scr_style;
|
||||
|
||||
extern const lv_font_t lv_font_portfolio_6x8;
|
||||
|
||||
esp_err_t display_on(void);
|
||||
esp_err_t display_off(void);
|
||||
|
||||
static void theme_apply(lv_theme_t *theme, lv_obj_t *obj) {
|
||||
if (lv_obj_get_parent(obj) == NULL) {
|
||||
lv_obj_add_style(obj, &scr_style, LV_PART_MAIN);
|
||||
@ -61,7 +67,6 @@ esp_err_t display_init(void * pvParameters)
|
||||
ESP_RETURN_ON_ERROR(esp_lcd_new_panel_io_i2c(i2c_master_bus_handle, &io_config, &io_handle), TAG, "Failed to initialise i2c panel bus");
|
||||
|
||||
ESP_LOGI(TAG, "Install SSD1306 panel driver");
|
||||
esp_lcd_panel_handle_t panel_handle = NULL;
|
||||
esp_lcd_panel_dev_config_t panel_config = {
|
||||
.bits_per_pixel = 1,
|
||||
.reset_gpio_num = -1,
|
||||
@ -123,7 +128,10 @@ esp_err_t display_init(void * pvParameters)
|
||||
}
|
||||
|
||||
// Only turn on the screen when it has been cleared
|
||||
ESP_RETURN_ON_ERROR(esp_lcd_panel_disp_on_off(panel_handle, true), TAG, "Panel display on failed");
|
||||
esp_err_t esp_err = display_on();
|
||||
if (ESP_OK != esp_err) {
|
||||
return esp_err;
|
||||
}
|
||||
|
||||
GLOBAL_STATE->SYSTEM_MODULE.is_screen_active = true;
|
||||
} else {
|
||||
@ -132,3 +140,22 @@ esp_err_t display_init(void * pvParameters)
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t display_on(void)
|
||||
{
|
||||
if (!display_state_on && (NULL != panel_handle)) {
|
||||
ESP_RETURN_ON_ERROR(esp_lcd_panel_disp_on_off(panel_handle, true), TAG, "Panel display on failed");
|
||||
display_state_on = true;
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
esp_err_t display_off(void)
|
||||
{
|
||||
if (display_state_on && (NULL != panel_handle)) {
|
||||
ESP_RETURN_ON_ERROR(esp_lcd_panel_disp_on_off(panel_handle, false), TAG, "Panel display off failed");
|
||||
display_state_on = false;
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
@ -2,5 +2,7 @@
|
||||
#define DISPLAY_H_
|
||||
|
||||
esp_err_t display_init(void * pvParameters);
|
||||
esp_err_t display_on(void);
|
||||
esp_err_t display_off(void);
|
||||
|
||||
#endif /* DISPLAY_H_ */
|
||||
|
@ -49,6 +49,15 @@
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="field grid p-fluid">
|
||||
<label htmlFor="displayTimeout" class="col-12 mb-2 md:col-2 md:mb-0">Display Timeout</label>
|
||||
<div class="col-12 md:col-10">
|
||||
<label>{{form.controls['displayTimeout'].value}} Minute(s)
|
||||
<b *ngIf="form.controls['displayTimeout'].value == 0" style="color: #F2A900">Disabled</b></label>
|
||||
<p-slider formControlName="displayTimeout" [min]="0" [max]="60"></p-slider>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-12 md:col-4">
|
||||
<div class="field-checkbox">
|
||||
<p-checkbox name="flipscreen" formControlName="flipscreen" inputId="flipscreen"
|
||||
|
@ -186,6 +186,7 @@ export class EditComponent implements OnInit, OnDestroy {
|
||||
this.form = this.fb.group({
|
||||
flipscreen: [info.flipscreen == 1],
|
||||
invertscreen: [info.invertscreen == 1],
|
||||
displayTimeout: [info.displayTimeout, [Validators.required]],
|
||||
coreVoltage: [info.coreVoltage, [Validators.required]],
|
||||
frequency: [info.frequency, [Validators.required]],
|
||||
autofanspeed: [info.autofanspeed == 1, [Validators.required]],
|
||||
|
@ -57,6 +57,7 @@ export class SettingsComponent {
|
||||
this.form = this.fb.group({
|
||||
flipscreen: [info.flipscreen == 1],
|
||||
invertscreen: [info.invertscreen == 1],
|
||||
displayTimeout: [info.displayTimeout, [Validators.required]],
|
||||
stratumURL: [info.stratumURL, [
|
||||
Validators.required,
|
||||
Validators.pattern(/^(?!.*stratum\+tcp:\/\/).*$/),
|
||||
|
@ -58,6 +58,7 @@ export class SystemService {
|
||||
boardVersion: "204",
|
||||
flipscreen: 1,
|
||||
invertscreen: 0,
|
||||
displayTimeout: 0,
|
||||
invertfanpolarity: 1,
|
||||
autofanspeed: 1,
|
||||
fanspeed: 100,
|
||||
|
@ -9,6 +9,7 @@ export interface ISystemInfo {
|
||||
|
||||
flipscreen: number;
|
||||
invertscreen: number;
|
||||
displayTimeout: number;
|
||||
power: number,
|
||||
voltage: number,
|
||||
current: number,
|
||||
|
@ -463,6 +463,9 @@ static esp_err_t PATCH_update_settings(httpd_req_t * req)
|
||||
if ((item = cJSON_GetObjectItem(root, "invertscreen")) != NULL) {
|
||||
nvs_config_set_u16(NVS_CONFIG_INVERT_SCREEN, item->valueint);
|
||||
}
|
||||
if ((item = cJSON_GetObjectItem(root, "displayTimeout")) != NULL) {
|
||||
nvs_config_set_u16(NVS_CONFIG_DISPLAY_TIMEOUT, item->valueint);
|
||||
}
|
||||
if ((item = cJSON_GetObjectItem(root, "invertfanpolarity")) != NULL) {
|
||||
nvs_config_set_u16(NVS_CONFIG_INVERT_FAN_POLARITY, item->valueint);
|
||||
}
|
||||
@ -595,6 +598,7 @@ static esp_err_t GET_system_info(httpd_req_t * req)
|
||||
cJSON_AddNumberToObject(root, "overheat_mode", nvs_config_get_u16(NVS_CONFIG_OVERHEAT_MODE, 0));
|
||||
cJSON_AddNumberToObject(root, "overclockEnabled", nvs_config_get_u16(NVS_CONFIG_OVERCLOCK_ENABLED, 0));
|
||||
cJSON_AddNumberToObject(root, "invertscreen", nvs_config_get_u16(NVS_CONFIG_INVERT_SCREEN, 0));
|
||||
cJSON_AddNumberToObject(root, "displayTimeout", nvs_config_get_u16(NVS_CONFIG_DISPLAY_TIMEOUT, 0));
|
||||
|
||||
cJSON_AddNumberToObject(root, "invertfanpolarity", nvs_config_get_u16(NVS_CONFIG_INVERT_FAN_POLARITY, 1));
|
||||
cJSON_AddNumberToObject(root, "autofanspeed", nvs_config_get_u16(NVS_CONFIG_AUTO_FAN_SPEED, 1));
|
||||
|
@ -23,6 +23,7 @@
|
||||
#define NVS_CONFIG_BOARD_VERSION "boardversion"
|
||||
#define NVS_CONFIG_FLIP_SCREEN "flipscreen"
|
||||
#define NVS_CONFIG_INVERT_SCREEN "invertscreen"
|
||||
#define NVS_CONFIG_DISPLAY_TIMEOUT "displayTimeout"
|
||||
#define NVS_CONFIG_INVERT_FAN_POLARITY "invertfanpol"
|
||||
#define NVS_CONFIG_AUTO_FAN_SPEED "autofanspeed"
|
||||
#define NVS_CONFIG_FAN_SPEED "fanspeed"
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "esp_lvgl_port.h"
|
||||
#include "global_state.h"
|
||||
#include "screen.h"
|
||||
#include "nvs_config.h"
|
||||
#include "display.h"
|
||||
|
||||
// static const char * TAG = "screen";
|
||||
|
||||
@ -227,6 +229,10 @@ static lv_obj_t * create_scr_stats() {
|
||||
|
||||
static void screen_show(screen_t screen)
|
||||
{
|
||||
if (SCR_CAROUSEL_START > current_screen) {
|
||||
lv_display_trigger_activity(NULL);
|
||||
}
|
||||
|
||||
if (current_screen != screen) {
|
||||
lv_obj_t * scr = screens[screen];
|
||||
|
||||
@ -347,6 +353,7 @@ static void screen_update_cb(lv_timer_t * timer)
|
||||
lv_label_set_text_fmt(difficulty_label, "Best: %s !!! BLOCK FOUND !!!", module->best_session_diff_string);
|
||||
|
||||
screen_show(SCR_STATS);
|
||||
lv_display_trigger_activity(NULL);
|
||||
} else {
|
||||
if (current_difficulty != module->best_session_nonce_diff) {
|
||||
lv_label_set_text_fmt(difficulty_label, "Best: %s/%s", module->best_session_diff_string, module->best_diff_string);
|
||||
@ -362,6 +369,15 @@ static void screen_update_cb(lv_timer_t * timer)
|
||||
current_difficulty = module->best_session_nonce_diff;
|
||||
current_chip_temp = power_management->chip_temp_avg;
|
||||
|
||||
const uint32_t display_inactive_time = lv_display_get_inactive_time(NULL);
|
||||
const uint16_t display_timeout_config = nvs_config_get_u16(NVS_CONFIG_DISPLAY_TIMEOUT, 0) * 60 * 1000;
|
||||
|
||||
if ((0 != display_timeout_config) && (display_inactive_time > display_timeout_config)) {
|
||||
display_off();
|
||||
} else {
|
||||
display_on();
|
||||
}
|
||||
|
||||
if (CAROUSEL_DELAY_COUNT > current_screen_counter || found_block) {
|
||||
return;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ In the event that the admin web front end is inaccessible, for example because o
|
||||
|
||||
### Unlock Settings
|
||||
|
||||
In order to unlock the Input fields for ASIC Mhz and ASIC Voltage you need to open up your Browser console (mostly done by pressing F12). If you submit the command `unlockSettings()` your input fields for ASIC Mhz and ASIC Voltage will be unlocked and you can place other values out of the predefined scope into them.
|
||||
In order to unlock the Input fields for ASIC Frequency and ASIC Core Voltage you need to append `?oc` to the end of the settings tab URL in your browser. Be aware that without additional cooling overclocking can overheat and/or damage your Bitaxe.
|
||||
|
||||
## Development
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user