fix warnings
This commit is contained in:
@@ -19,6 +19,7 @@ static void try_step4(void) { clean_bomb(); step4(); }
|
||||
static void try_step5(void) { clean_bomb(); step5(); }
|
||||
static void try_step6(void) { clean_bomb(); step6(); }
|
||||
static void issue_strike(void) { strike("Strike Issued"); }
|
||||
static void debug_switches(void);
|
||||
|
||||
/// Wait for "*9819"
|
||||
void step0(void) {
|
||||
@@ -43,6 +44,12 @@ void step0(void) {
|
||||
.should_exit = false,
|
||||
.callback = set_game_time,
|
||||
},
|
||||
{
|
||||
.code = "*598623",
|
||||
.display_text = "Debug Switches",
|
||||
.should_exit = false,
|
||||
.callback = debug_switches,
|
||||
},
|
||||
{
|
||||
.code = "*59871",
|
||||
.display_text = "Try Step 1",
|
||||
@@ -232,3 +239,43 @@ static void set_game_time(void) {
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void print_bin(char* out_str, uint8_t n) {
|
||||
out_str[0] = ((n & 0b1000) ? '1' : '0');
|
||||
out_str[1] = ((n & 0b0100) ? '1' : '0');
|
||||
out_str[2] = ((n & 0b0010) ? '1' : '0');
|
||||
out_str[3] = ((n & 0b0001) ? '1' : '0');
|
||||
}
|
||||
|
||||
static void debug_switches(void) {
|
||||
clean_bomb();
|
||||
uint8_t switch_state = 0;
|
||||
uint8_t button_state = 0;
|
||||
|
||||
char buff[5] = {0};
|
||||
|
||||
KeypadKey key;
|
||||
while (1) {
|
||||
uint8_t new_button_state = get_button_state();
|
||||
if (new_button_state != button_state) {
|
||||
button_state = new_button_state;
|
||||
print_bin(buff, button_state);
|
||||
ESP_LOGI("main", "b: 0b%s", buff);
|
||||
}
|
||||
|
||||
uint8_t new_switch_state = get_switch_state();
|
||||
if (new_switch_state != switch_state) {
|
||||
switch_state = new_switch_state;
|
||||
print_bin(buff, switch_state);
|
||||
ESP_LOGI("main", "s: 0b%s", buff);
|
||||
}
|
||||
|
||||
if (get_pressed_keypad(&key) && key == KeypadKey::pound) {
|
||||
return;
|
||||
}
|
||||
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,8 +90,7 @@ void step2(void) {
|
||||
int solved_times = 0;
|
||||
|
||||
new_puzzle();
|
||||
int strike_time = xTaskGetTickCount();
|
||||
bool striked = false;
|
||||
int strike_time = 0;
|
||||
while(solved_times < NUM_SOLVES) {
|
||||
// for every bit in the answer-
|
||||
set_module_sseg_raw(display_map);
|
||||
@@ -111,13 +110,12 @@ void step2(void) {
|
||||
}
|
||||
} else {
|
||||
strike_time = xTaskGetTickCount();
|
||||
striked = true;
|
||||
strike("Incorrect Character!");
|
||||
}
|
||||
}
|
||||
|
||||
if (xTaskGetTickCount() - strike_time > pdMS_TO_TICKS(5000)) {
|
||||
striked = false;
|
||||
if (strike_time != 0 && xTaskGetTickCount() - strike_time > pdMS_TO_TICKS(5000)) {
|
||||
strike_time = 0;
|
||||
lcd_clear(&lcd);
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
|
||||
@@ -386,8 +386,6 @@ void step5(void) {
|
||||
int buttons_pressed = 0;
|
||||
|
||||
ButtonKey button;
|
||||
KeypadKey key;
|
||||
|
||||
while (1) {
|
||||
if (get_pressed_button(&button)) {
|
||||
buttons_pressed++;
|
||||
|
||||
Reference in New Issue
Block a user