<commit_before>#include <stdio.h> 
#include "types.h"
#include "di_util.h"

ERROR_T Shutdown_Step(INPUT_T *input, OUTPUT_T *output, STATE_T *state, MODE_REQUEST_T mode_request){
    
    ACCESSORIES_OUTPUT_REQUEST_T *acc_out = convert_acc(input->acc_input);
        if(mode_request == REQ_OFF) {
	INPUT_MESSAGES inp_messages = input->messages;
	
	bool BMS_hb = inp_messages->BMS_heartbeat;
	bool PDM_hb = inp_messages->PDM_heartbeat;
	bool throttle_hb = inp_messages->throttle_heartbeat;
	uint16_t vel  = inp_messages->velocity;
 	
	//returns error when velocity is not zero & shutdown is attempted
	if(vel != 0){
	    return ERROR_VELOCITY_NOT_ZERO;
	}
	
	//follow the shutdown sequence
	output->close_contactors = false;
	output->acc_output = turn_all_off();

	OUTPUT_MESSAGES_T out_messages;
	out_messages.test = false;
	out_messages.send_heartbeat = false;
	out_messages.drive_mode = MESSAGE_PARKED_AUX;
	output->messages = &out_messages;
	
	//If adding FAIL state mode, then add a possibility of entering the<commit_msg>allowed drive_mode to be 'aux' or 'shutdown_impending'<commit_after>#include <stdio.h> 
#include "types.h"
#include "di_util.h"

ERROR_T Shutdown_Step(INPUT_T *input, OUTPUT_T *output, STATE_T *state, MODE_REQUEST_T mode_request){
    
    ACCESSORIES_OUTPUT_REQUEST_T *acc_out = convert_acc(input->acc_input);
        if(mode_request == REQ_OFF) {
	INPUT_MESSAGES inp_messages = input->messages;
	
	bool BMS_hb = inp_messages->BMS_heartbeat;
	bool PDM_hb = inp_messages->PDM_heartbeat;
	bool throttle_hb = inp_messages->throttle_heartbeat;
	uint16_t vel  = inp_messages->velocity;
 	
	//returns error when velocity is not zero & shutdown is attempted
	if(vel != 0){
	    return ERROR_VELOCITY_NOT_ZERO;
	}
	
	//follow the shutdown sequence
	output->close_contactors = false;
	output->acc_output = turn_all_off();

	OUTPUT_MESSAGES_T out_messages;
	out_messages.test = false;
	out_messages.send_heartbeat = false;
	out_messages.drive_mode = (!BMS_hb && !PDM_hb && !throttle_hb) ? MESSAGE_PARKED_AUX : MESSAGE_SHUTDOWN_IMPENDING;
	output->messages = &out_messages;
	
	//If adding FAIL state mode, then add a possibility of entering the
{'fraction_non_alphanumeric': 0.09587772116720704, 'fraction_numerical': 0.002779064381658175, 'mean_word_length': 5.153846153846154, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '81673', 'n_tokens_mistral': 818, 'n_tokens_neox': 766, 'n_words': 167}