mirror of
https://github.com/joeycastillo/second-movement.git
synced 2025-10-29 11:38:27 +00:00
remove unnecessary demo watch faces
This commit is contained in:
parent
1e9dc049bf
commit
4b2c46630e
@ -37,7 +37,6 @@
|
||||
#include "character_set_face.h"
|
||||
#include "accelerometer_status_face.h"
|
||||
#include "all_segments_face.h"
|
||||
#include "float_demo_face.h"
|
||||
#include "temperature_display_face.h"
|
||||
#include "temperature_logging_face.h"
|
||||
#include "activity_logging_face.h"
|
||||
@ -47,6 +46,5 @@
|
||||
#include "settings_face.h"
|
||||
#include "light_sensor_face.h"
|
||||
#include "irda_upload_face.h"
|
||||
#include "file_demo_face.h"
|
||||
#include "chirpy_demo_face.h"
|
||||
// New includes go above this line.
|
||||
|
||||
@ -12,7 +12,6 @@ SRCS += \
|
||||
./watch-faces/demo/accelerometer_status_face.c \
|
||||
./watch-faces/demo/all_segments_face.c \
|
||||
./watch-faces/demo/character_set_face.c \
|
||||
./watch-faces/demo/float_demo_face.c \
|
||||
./watch-faces/sensor/temperature_display_face.c \
|
||||
./watch-faces/sensor/temperature_logging_face.c \
|
||||
./watch-faces/sensor/activity_logging_face.c \
|
||||
@ -21,7 +20,6 @@ SRCS += \
|
||||
./watch-faces/settings/preferences_face.c \
|
||||
./watch-faces/settings/settings_face.c \
|
||||
./watch-faces/demo/light_sensor_face.c \
|
||||
./watch-faces/demo/file_demo_face.c \
|
||||
./watch-faces/io/chirpy_demo_face.c \
|
||||
./watch-faces/io/irda_upload_face.c \
|
||||
# New watch faces go above this line.
|
||||
|
||||
@ -1,109 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2024 Joey Castillo
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "file_demo_face.h"
|
||||
#include "tc.h"
|
||||
#include "eic.h"
|
||||
#include "usb.h"
|
||||
#include "uart.h"
|
||||
#include "filesystem.h"
|
||||
|
||||
#ifdef HAS_IR_SENSOR
|
||||
|
||||
void file_demo_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) watch_face_index;
|
||||
if (*context_ptr == NULL) {
|
||||
*context_ptr = malloc(sizeof(file_demo_state_t));
|
||||
memset(*context_ptr, 0, sizeof(file_demo_state_t));
|
||||
// Do any one-time tasks in here; the inside of this conditional happens only at boot.
|
||||
}
|
||||
}
|
||||
|
||||
void file_demo_face_activate(void *context) {
|
||||
file_demo_state_t *state = (file_demo_state_t *)context;
|
||||
(void) state;
|
||||
}
|
||||
|
||||
bool file_demo_face_loop(movement_event_t event, void *context) {
|
||||
file_demo_state_t *state = (file_demo_state_t *)context;
|
||||
(void) state;
|
||||
char buf[7];
|
||||
|
||||
switch (event.event_type) {
|
||||
case EVENT_NONE:
|
||||
case EVENT_ACTIVATE:
|
||||
REDISPLAY:
|
||||
watch_clear_display();
|
||||
// display the contents of a file called "1TEST"
|
||||
if (filesystem_file_exists("1TEST")) {
|
||||
filesystem_read_file("1TEST", buf, sizeof(buf));
|
||||
buf[6] = 0;
|
||||
watch_display_text_with_fallback(WATCH_POSITION_TOP, "TF", "TST F");
|
||||
watch_display_text(WATCH_POSITION_BOTTOM, buf);
|
||||
} else {
|
||||
watch_display_text(WATCH_POSITION_FULL, "NO FILE ");
|
||||
}
|
||||
break;
|
||||
case EVENT_TICK:
|
||||
break;
|
||||
case EVENT_LIGHT_BUTTON_DOWN:
|
||||
state->delete_enabled = false;
|
||||
goto REDISPLAY;
|
||||
break;
|
||||
case EVENT_ALARM_BUTTON_UP:
|
||||
if (state->delete_enabled) {
|
||||
filesystem_rm("1TEST");
|
||||
movement_force_led_off();
|
||||
state->delete_enabled = false;
|
||||
goto REDISPLAY;
|
||||
} else if (filesystem_file_exists("1TEST")) {
|
||||
movement_force_led_on(255, 0, 0);
|
||||
watch_clear_display();
|
||||
watch_display_text(WATCH_POSITION_BOTTOM, "0ElET?");
|
||||
state->delete_enabled = true;
|
||||
}
|
||||
break;
|
||||
case EVENT_TIMEOUT:
|
||||
// movement_move_to_face(0);
|
||||
break;
|
||||
case EVENT_LOW_ENERGY_UPDATE:
|
||||
watch_display_text(WATCH_POSITION_TOP_RIGHT, " <");
|
||||
break;
|
||||
default:
|
||||
return movement_default_loop_handler(event);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void file_demo_face_resign(void *context) {
|
||||
file_demo_state_t *state = (file_demo_state_t *)context;
|
||||
|
||||
movement_force_led_off();
|
||||
state->delete_enabled = false;
|
||||
}
|
||||
|
||||
#endif // HAS_IR_SENSOR
|
||||
@ -1,52 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2024 Joey Castillo
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "movement.h"
|
||||
|
||||
/*
|
||||
* FILE DISPLAY DEMO
|
||||
*
|
||||
* Displays the contents of a file on the watch.
|
||||
* For use with the irda_upload_face that allows uploading files to the watch.
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
bool delete_enabled;
|
||||
} file_demo_state_t;
|
||||
|
||||
void file_demo_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void file_demo_face_activate(void *context);
|
||||
bool file_demo_face_loop(movement_event_t event, void *context);
|
||||
void file_demo_face_resign(void *context);
|
||||
|
||||
#define file_demo_face ((const watch_face_t){ \
|
||||
file_demo_face_setup, \
|
||||
file_demo_face_activate, \
|
||||
file_demo_face_loop, \
|
||||
file_demo_face_resign, \
|
||||
NULL, \
|
||||
})
|
||||
@ -1,69 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2022 Joey Castillo
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "float_demo_face.h"
|
||||
#include "watch.h"
|
||||
|
||||
void float_demo_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) watch_face_index;
|
||||
if (*context_ptr == NULL) *context_ptr = malloc(sizeof(float));
|
||||
}
|
||||
|
||||
void float_demo_face_activate(void *context) {
|
||||
float *value = (float *)context;
|
||||
*value = -110;
|
||||
watch_display_text_with_fallback(WATCH_POSITION_TOP, "FLOAT", "FL");
|
||||
movement_request_tick_frequency(16);
|
||||
}
|
||||
|
||||
bool float_demo_face_loop(movement_event_t event, void *context) {
|
||||
float *value = (float *)context;
|
||||
switch (event.event_type) {
|
||||
case EVENT_TICK:
|
||||
*value = (*value) + 0.31;
|
||||
// fall through
|
||||
case EVENT_ACTIVATE:
|
||||
watch_display_float_with_best_effort(*value, "#F");
|
||||
break;
|
||||
case EVENT_ALARM_BUTTON_UP:
|
||||
*value = -100;
|
||||
movement_request_tick_frequency(16);
|
||||
break;
|
||||
case EVENT_ALARM_LONG_PRESS:
|
||||
*value = -10.85;
|
||||
movement_request_tick_frequency(1);
|
||||
break;
|
||||
default:
|
||||
movement_default_loop_handler(event);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void float_demo_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* MIT License
|
||||
*
|
||||
* Copyright (c) 2024 Joey Castillo
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef FLOAT_DEMO_FACE_H_
|
||||
#define FLOAT_DEMO_FACE_H_
|
||||
|
||||
/*
|
||||
* FLOAT DEMO
|
||||
*
|
||||
* To be deleted, tests float display functionality.
|
||||
*/
|
||||
|
||||
#include "movement.h"
|
||||
|
||||
void float_demo_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void float_demo_face_activate(void *context);
|
||||
bool float_demo_face_loop(movement_event_t event, void *context);
|
||||
void float_demo_face_resign(void *context);
|
||||
|
||||
#define float_demo_face ((const watch_face_t){ \
|
||||
float_demo_face_setup, \
|
||||
float_demo_face_activate, \
|
||||
float_demo_face_loop, \
|
||||
float_demo_face_resign, \
|
||||
NULL, \
|
||||
})
|
||||
|
||||
#endif // FLOAT_DEMO_FACE_H_
|
||||
Loading…
x
Reference in New Issue
Block a user