2023-05-10 18:20:37 -04:00
|
|
|
#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
|
2023-06-19 22:35:55 -04:00
|
|
|
|
|
|
|
#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;
|
2023-06-09 14:49:56 -04:00
|
|
|
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];
|
2023-06-08 17:48:26 -04:00
|
|
|
uint32_t best_nonce_diff;
|
2023-06-19 22:35:55 -04:00
|
|
|
char best_diff_string[DIFF_STRING_SIZE];
|
2023-06-09 19:30:28 -04:00
|
|
|
bool FOUND_BLOCK;
|
2023-06-21 19:00:09 -04:00
|
|
|
bool startup_done;
|
|
|
|
char ssid[20];
|
|
|
|
char wifi_status[20];
|
2023-06-09 14:49:56 -04:00
|
|
|
|
|
|
|
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-05-10 18:20:37 -04:00
|
|
|
|
2023-06-06 09:06:30 -04:00
|
|
|
#endif /* SYSTEM_H_ */
|