Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/42-Smart-Cluster-Sign.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ void IRAM_ATTR isr_warning(void);
void cluster_number_mode(unsigned int* p_sleep_length);

/* display_handling.cpp */
void draw_colour_bitmap(const unsigned char* black_image, const unsigned char* red_image);
void IRAM_ATTR display_cluster_number(IMAGE_t mode);
void clear_display(void);
void IRAM_ATTR draw_on_display(IMAGE_t mode);
void IRAM_ATTR display_init(void);

/* exam_mode.cpp */
Expand Down
4 changes: 2 additions & 2 deletions src/battery_management.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ void battery_monitor(void)
return ;
if (battery < BATTERY_CRITICAL)
{
display_cluster_number(LOW_BATTERY);
draw_on_display(LOW_BATTERY);
DEBUG_PRINTF("[BATTERY] Battery charge 0%%! Going into extensive sleep\n\n");
send_telegram_message(compose_message(DEAD_BATTERY, 0));
com_g.block_validation = true;
go_to_sleep(DEAD_BATTERY_SLEEP_MS);
}
else if (battery < BATTERY_GOOD)
{
display_cluster_number(LOW_BATTERY);
draw_on_display(LOW_BATTERY);
DEBUG_PRINTF("[BATTERY] Low battery. Need charging.\n\n");
send_telegram_message(compose_message(LOW_BATTERY, 0));
}
Expand Down
8 changes: 4 additions & 4 deletions src/cluster_number_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static bool handle_secret_expiration(void)
days_left = expiration_counter();
if (days_left <= 3 && days_left != FAILED_TO_COUNT)
{
display_cluster_number(SECRET_EXPIRED);
draw_on_display(SECRET_EXPIRED);
DEBUG_PRINTF("\n[INTRA] IT IS TIME TO UPDATE THE SECRET!\n");
send_telegram_message(compose_message(SECRET_EXPIRED, days_left));
return (true);
Expand Down Expand Up @@ -56,7 +56,7 @@ static bool ensure_exams(unsigned int* p_sleep_length)
{
send_telegram_message(compose_message(intra_status, 0));
WiFi.mode(WIFI_OFF);
display_cluster_number(INTRA_ERROR);
draw_on_display(INTRA_ERROR);
DEBUG_PRINTF("\n[INTRA] ERROR OBTAINING EXAMS. Turning off\n");
rtc_g.exam_status = false;
*p_sleep_length = time_till_wakeup();
Expand Down Expand Up @@ -92,14 +92,14 @@ void cluster_number_mode(unsigned int* p_sleep_length)
*p_sleep_length = REBOOT;
else
{
display_cluster_number(EXAM_DAY);
draw_on_display(EXAM_DAY);
*p_sleep_length = time_till_event(rtc_g.exam_start_hour - 1, rtc_g.exam_start_minutes);
}
return;
}
*p_sleep_length = time_till_wakeup();
if (handle_secret_expiration())
return;
display_cluster_number(DEFAULT_IMG);
draw_on_display(CLUSTER_DEFAULT);
}

2 changes: 1 addition & 1 deletion src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef CONFIG_H
# define CONFIG_H

# define SOFTWARE_VERSION 4.38
# define SOFTWARE_VERSION 4.40
# define DEVICE_NAME "42PRAGUEAPI SCREEN"

# define DEBUG // comment out this line to turn off Serial output
Expand Down
17 changes: 11 additions & 6 deletions src/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
# define REBOOT 1000
# define mS_TO_uS_FACTOR 1000ull // milliseconds to microseconds
# define mS_TO_S_FACTOR 1000ul // milliseconds to seconds
# define MINUTE_MS 60000
# define HOUR_MS 3600000
# define ONE_SECOND_MS 1000
# define ONE_MINUTE_MS 60000
# define ONE_HOUR_MS 3600000
# define MONTHS_DAYS 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
# define YEAR_DAYS 365
# define NOT_FOUND -1
Expand Down Expand Up @@ -55,8 +56,7 @@

/* Images constants */
typedef enum {
CLUSTER = 1000,
DEFAULT_IMG,
CLUSTER_DEFAULT = 100,
INTRA_ERROR,
SECRET_EXPIRED,
EXAM_DAY,
Expand All @@ -67,12 +67,17 @@ typedef enum {
OTA_FAIL,
OTA_CANCELED,
TELEGRAM_ERROR,
TELEGRAM_STATUS
TELEGRAM_STATUS,
PREEXAM_50,
PREEXAM_25,
PREEXAM_5,
EXAM_ACTIVE,
BLANK
} IMAGE_t;

/* Errors constants */
typedef enum {
UNKNOWN = 2000,
UNKNOWN = 200,
TIME_OK,
TIME_NO_WIFI,
TIME_NO_SERVER,
Expand Down
Loading
Loading