Skip to content

Commit

Permalink
Minor improvements.
Browse files Browse the repository at this point in the history
Removed the utc_offset variable since its redundant.
  • Loading branch information
chathura-de-silva committed Mar 12, 2024
1 parent 33676db commit 4ef3e05
Show file tree
Hide file tree
Showing 7 changed files with 352 additions and 363 deletions.
4 changes: 2 additions & 2 deletions include/Functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ void go_to_menu();
void update_time_with_check_alarm();
void println(String text, int column, int row, int text_size, bool display_now = false, int color = WHITE);
void println(tm timeinfo, const char *text, int column, int row, int text_size, bool display_now = false, int color = WHITE);
void show_modal_page(const unsigned char* bitmap,int period, String text, int x_offset);
void show_modal_page(const unsigned char *bitmap, int period, String text, int x_offset);

// FUnctions from temperature.cpp
void check_temp();
Expand All @@ -21,7 +21,7 @@ void set_time_zone();
void update_time();
void print_time_now();

//Functions of preferences.cpp
// Functions of preferences.cpp
void load_user_settings();
void save_time_zone();
void save_alarm(int alarm);
Expand Down
13 changes: 6 additions & 7 deletions include/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ extern int alarm_hours[];
extern int alarm_minutes[];
extern bool alarm_triggered[];
extern struct tm timeinfo;
extern int utc_offset;
extern int temp_offset_hours;
extern int temp_offset_minutes;
//images
// images
extern const unsigned char splashScreen[];
extern const unsigned char tick[];
extern const unsigned char wifi[];
extern const unsigned char waveformAnimation[31][1024];
extern const unsigned char time_zone [];
extern const unsigned char alarm_ring [];
extern const unsigned char alarm_disable [];
extern const unsigned char medicine_time [];
extern const unsigned char reset [];
extern const unsigned char time_zone[];
extern const unsigned char alarm_ring[];
extern const unsigned char alarm_disable[];
extern const unsigned char medicine_time[];
extern const unsigned char reset[];
23 changes: 12 additions & 11 deletions src/alarms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ const int notes[] = {C, D, E, F, G, A, B, C_H};

void ring_alarm()
{
// Turning the LED ON
// Turning the LED ON
digitalWrite(LED_1, HIGH);
show_modal_page(medicine_time ,200,"It's Medicine Time!", 8);
show_modal_page(medicine_time, 200, "It's Medicine Time!", 8);
// Ringing the buzzer

bool break_happened = false;
Expand Down Expand Up @@ -57,9 +57,9 @@ void set_alarm(int alarm)
{
display.clearDisplay();
display.fillRoundRect(23, 12, 39, 34, 4, WHITE);
println(formatNumber(temp_hour), 26, 18, 3,false, BLACK);
println(formatNumber(temp_minute), 76, 18, 3,true, WHITE);
println(":", 60, 18, 3,true, WHITE);
println(formatNumber(temp_hour), 26, 18, 3, false, BLACK);
println(formatNumber(temp_minute), 76, 18, 3, true, WHITE);
println(":", 60, 18, 3, true, WHITE);
int pressed = wait_for_button_press();

if (pressed == PB_UP)
Expand Down Expand Up @@ -94,10 +94,10 @@ void set_alarm(int alarm)
while (true)
{
display.fillRoundRect(23, 12, 39, 34, 4, BLACK);
println(formatNumber(temp_hour), 26, 18, 3,false, WHITE);
//Above two lines removes the white background around the hour setting state.(i.e. inverts the hour part of the display back.)
println(formatNumber(temp_hour), 26, 18, 3, false, WHITE);
// Above two lines removes the white background around the hour setting state.(i.e. inverts the hour part of the display back.)
display.fillRoundRect(73, 12, 39, 34, 4, WHITE);
println(formatNumber(temp_minute), 76, 18, 3,true, BLACK);
println(formatNumber(temp_minute), 76, 18, 3, true, BLACK);

int pressed = wait_for_button_press();

Expand All @@ -121,17 +121,18 @@ void set_alarm(int alarm)
{
delay(50);
alarm_minutes[alarm] = temp_minute;
if (!alarm_enabled){
if (!alarm_enabled)
{
alarm_enabled = true;
save_is_alarm_enabled();
for (int i = 0; i < n_alarms; i++)
{
alarm_triggered[i] = true;
alarm_triggered[i] = true;
}
alarm_triggered[alarm] = false;
}

show_modal_page(alarm_ring,1000,"Alarm set to "+formatNumber(temp_hour)+":"+formatNumber(temp_minute),10);
show_modal_page(alarm_ring, 1000, "Alarm set to " + formatNumber(temp_hour) + ":" + formatNumber(temp_minute), 10);
save_alarm(alarm);
break;
}
Expand Down
Loading

0 comments on commit 4ef3e05

Please sign in to comment.