<commit_before>#include "stm32f4xx.h"
#include "stm32f4xx_gpio.h"
#include "stm32f429i_discovery_ioe.h"
#include "FreeRTOS.h"

#include "cnc-controller.h"
#include "jogmode.h"

static uint32_t isInRect(uint32_t x, uint32_t y, uint32_t Height, uint32_t Width, uint32_t point_x, uint32_t point_y){
    if((point_x > x) && \
       (point_x < x + Width) && \
       (point_y > y) && \
       (point_y < y + Height)){
        return 1;
    }
    return 0;
}


void jogUI(void *pvParameters){
    TP_STATE *tp;

    while(1){
        tp = IOE_TP_GetState(); 

        if( tp->TouchDetected ){
            if(isInRect(60, 25, 60, 120, tp->X, tp->Y)){
                CNC_SetFeedrate(100);
                CNC_Move(20, 0, 0);
            }else if(isInRect(60, 235, 60, 120, tp->X, tp->Y)){
                CNC_SetFeedrate(100);
                CNC_Move(-20, 0, 0);
            }else if(isInRect(30, 110, 100, 60, tp->X, tp->Y)){
                CNC_SetFeedrate(100);
                CNC_Move(0, 20, 0);
            }else if(isInRect(150, 110, 100,60, tp->X, tp->Y)){
                CNC_SetFeedrate(100);
                CNC_Move(0, -20, 0);
            }
        }
    }
}
<commit_msg>insert Delay on tp detections, prevent motor going crazy<commit_after>#include "stm32f4xx.h"
#include "stm32f4xx_gpio.h"
#include "stm32f429i_discovery_ioe.h"
#include "FreeRTOS.h"
#include "task.h"

#include "cnc-controller.h"
#include "jogmode.h"

static uint32_t isInRect(uint32_t x, uint32_t y, uint32_t Height, uint32_t Width, uint32_t point_x, uint32_t point_y){
    if((point_x > x) && \
       (point_x < x + Width) && \
       (point_y > y) && \
       (point_y < y + Height)){
        return 1;
    }
    return 0;
}


void jogUI(void *pvParameters){
    TP_STATE *tp;

    while(1){
        tp = IOE_TP_GetState(); 

        if( tp->TouchDetected ){
            if(isInRect(60, 25, 60, 120, tp->X, tp->Y)){
                CNC_SetFeedrate(100);
                CNC_Move(20, 0, 0);
                vTaskDelay(100 / portTICK_PERIOD_MS);
            }else if(isInRect(60, 235, 60, 120, tp->X, tp->Y)){
                CNC_SetFeedrate(100);
                CNC_Move(-20, 0, 0);
                vTaskDelay(100 / portTICK_PERIOD_MS);
            }else if(isInRect(30, 110, 100, 60, tp->X, tp->Y)){
                CNC_SetFeedrate(100);
                CNC_Move(0, 20, 0);
                vTaskDelay(100 / portTICK_PERIOD_MS);
            }else if(isInRect(150, 110, 100,60, tp->X, tp->Y)){
                CNC_SetFeedrate(100);
                CNC_Move(0, -20, 0);
                vTaskDelay(100 / portTICK_PERIOD_MS);
            }
        }
    }
}

{'fraction_non_alphanumeric': 0.14535104364326376, 'fraction_numerical': 0.07741935483870968, 'mean_word_length': 1.9223946784922394, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '174638', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1022, 'n_words': 202}