Skip to content

agmankaruse/Motor_Diagnostics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Motor Diagnostics

Motor Diagnostics is a MISRA-inspired embedded C project that simulates an automotive or industrial motor diagnostics ECU on a normal laptop. It monitors deterministic sensor samples, debounces noisy readings, detects persistent faults, advances a safety-oriented state machine, and records fault events in a fixed-size circular log.

This project is useful for practicing embedded C techniques without hardware: clear module boundaries, fixed-width integer types, no dynamic memory allocation, defensive checks, bounded buffers, explicit states, and simple testable logic.

Project Layout

Motor_Diagnostics/
├── README.md
├── Makefile
├── include/
│   ├── motor_sensor.h
│   ├── fault_supervisor.h
│   ├── system_state.h
│   └── fault_log.h
├── src/
│   ├── main.c
│   ├── motor_sensor.c
│   ├── fault_supervisor.c
│   ├── system_state.c
│   └── fault_log.c
├── tests/
│   ├── test_fault_supervisor.c
│   ├── test_system_state.c
│   └── test_fault_log.c
└── docs/
    ├── design.md
    └── misra_notes.md

Build

Install a C99 compiler and make. On Windows, MSYS2/MinGW, WSL, or another GNU-compatible toolchain works well.

make

Run

make run

Test

The tests are simple host-side C programs that use assert().

make test

Example Output

Sample  Volt(mV)  Temp(C)  Current(mA)  RPM   Heartbeat  Fault                     State                Log
1       12000     45       4000         1500  1          FAULT_NONE                SYSTEM_NORMAL        0
8       9000      45       4000         1500  8          FAULT_UNDER_VOLTAGE       SYSTEM_WARNING       1
15      12000     110      4000         1500  15         FAULT_OVER_TEMPERATURE    SYSTEM_SAFE_MODE     3
23      12000     45       36000        1500  23         FAULT_OVER_CURRENT        SYSTEM_SAFE_MODE     5

GitHub Upload

Use normal Git commands only:

git init
git branch -M main
git add .
git commit -m "Initial MISRA-style motor diagnostics project"
git remote -v
git remote remove origin
git remote add origin https://github.com/agmankaruse/Motor_Diagnostics.git
git push -u origin main

If origin does not exist, skip git remote remove origin and add the remote.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors