ESP-Miner/main/system.h

43 lines
1.1 KiB
C
Raw Permalink Normal View History

#ifndef SYSTEM_H_
#define SYSTEM_H_
2023-09-18 20:49:08 -04:00
#include <stdbool.h>
#include <stdint.h>
2023-06-06 14:09:51 -04:00
#define HISTORY_LENGTH 100
#define HISTORY_WINDOW_SIZE 5
#define DIFF_STRING_SIZE 10
2023-08-26 12:28:17 -04:00
typedef struct
{
2023-06-06 09:06:30 -04:00
double duration_start;
2023-06-06 14:09:51 -04:00
int historical_hashrate_rolling_index;
double historical_hashrate_time_stamps[HISTORY_LENGTH];
double historical_hashrate[HISTORY_LENGTH];
int historical_hashrate_init;
double current_hashrate;
int64_t start_time;
2023-06-06 14:09:51 -04:00
uint16_t shares_accepted;
uint16_t shares_rejected;
int screen_page;
2023-06-06 18:08:25 -04:00
char oled_buf[20];
uint32_t best_nonce_diff;
char best_diff_string[DIFF_STRING_SIZE];
bool FOUND_BLOCK;
bool startup_done;
char ssid[20];
char wifi_status[20];
uint32_t lastClockSync;
2023-06-06 08:19:46 -04:00
} SystemModule;
2023-06-06 18:08:25 -04:00
void SYSTEM_task(void *parameters);
2023-06-06 08:19:46 -04:00
2023-08-26 12:28:17 -04:00
void SYSTEM_notify_accepted_share(SystemModule *module);
void SYSTEM_notify_rejected_share(SystemModule *module);
void SYSTEM_notify_found_nonce(SystemModule *module, double pool_diff, double found_diff, uint32_t nbits);
void SYSTEM_notify_mining_started(SystemModule *module);
void SYSTEM_notify_new_ntime(SystemModule *module, uint32_t ntime);
2023-06-06 09:06:30 -04:00
#endif /* SYSTEM_H_ */