# PowerFC Tuner User Guide

Current app version: `V2.13`

## Purpose

PowerFC Tuner is intended to become a modern Windows tuning tool for Apexi PowerFC ECUs. The current build supports map viewing, offline tuning, serial map reads, map/session saving, PFC settings windows, auxiliary input calibration, and early logging/autotuning UI.

The application separates live PowerFC data from editable working data:

- `PFC Maps` shows what was read from the PowerFC.
- `Tuning` shows editable working maps.
- Opening a `.dat` file populates `Tuning`, not `PFC Maps`.
- Reading from the car populates `PFC Maps` and can also be copied into `Tuning`.

## Live Monitoring

Select a COM port from `Setup > Port`, then use `Read Maps from Car`. Live monitoring can only start after maps have been read from the PowerFC. A successful `Read Maps from Car` starts monitoring automatically. The header gauges show live RPM, AFR, and speed when the PowerFC responds.

AFR is calculated from the selected Auxiliary Connections analog 0-5 V input. Configure that input for your wideband scaling before logging or autotuning.

Open `AutoTuning & Logging > Live Monitors` to see grouped decoded live data, including RPM, load, speed, TPS, temperature, knock, injector pulse, ignition, voltage, AFR, and checksum status.

Set TPS 0% and 100% under `AutoTuning & Logging > Autotuning Options` before relying on throttle-position checks.

`AutoTuning & Logging > Logged Data` combines sample counts, logged AFR, logged knock, AFR difference, and base-map changes. While monitoring, the map tracer highlights the nearest RPM/load cell on the map grids.

## First Launch

When no app settings exist, the welcome screen shows:

```text
No working folder selected.
```

Create a new session from:

```text
File > New Session
```

You will be prompted to choose a working folder. The app then creates:

```text
Backups\
Sessions\
Working\
Working\Maps\
Working\Logs\
Working\Settings\
```

## File Menu

### New Session

Creates a new working session and prompts for a working folder. This clears the currently loaded map/session from the app window.

### Open Map

Loads a `.dat` or `.txt` map file into the editable `Tuning` tab. This does not overwrite the current `PFC Maps` data.

### Save Map

Saves the current working map data as a `.dat` file.

When offline, tuning-page buttons say `Save Map`. When online, they say `Write Map to PFC`.

### Open Previous Session

Loads a saved `.pfcsession` file, including:

- Working map data
- PFC map data, if saved
- AFR target map
- Logged AFR
- Logged knock
- Samples
- Auxiliary input settings
- Autotuning settings
- TPS calibration values

### Save Session

Saves the full working state. Session files are saved as `.pfcsession`, with sidecar `.dat` files for PFC and working map records when available.

## Setup Menu

### Port

Selects the serial COM port used for PowerFC communication.

### Working Folder

Changes the current working folder without starting a new session.

### Serial

Selects baud and parity settings. Current WITE-style serial settings are:

```text
57600 baud
8 data bits
No parity
1 stop bit
No flow control
DTR disabled
RTS disabled
```

### Raw Data

Opens raw table data in a separate window.

## Settings Menu

Settings are shown in popup windows rather than a main tab. Each popup can read/write from the PFC when online, or save edited settings into the working map.

Available settings groups:

- `Rev / RPM`
- `Fuel & Inj Correction`
- `Airflow`
- `Ignition Correction`
- `Function Select`

If a settings popup has unsaved changes, closing it prompts before discarding the edits.

## Auxiliary Connections

The Auxiliary Connections window supports four analog 0-5 V inputs, mapped one-to-one to the Wite `AN1`, `AN2`, `AN3`, and `AN4` channels.

Each input includes:

- Name
- Poly calibration shortcut
- AFR source selection
- Voltage low
- Voltage high
- Value low
- Value high
- Unit

For a wideband AFR input, configure the matching voltage/value range. Example:

```text
Voltage low: 0
Voltage high: 5
Value low: 8
Value high: 20
Unit: AFR
```

The selected AFR source uses the same voltage-to-value calibration as the visible auxiliary input fields.

## PFC Maps

The `PFC Maps` tab is read-only. It is enabled only after a successful PowerFC read.

Maps currently shown:

- Injector Correction
- Base Map
- Ignition
- VVTi

Use `Reload All Maps` to reread all supported map packets from the PFC.

Use `Backup / Save Current Map` to save everything currently read from the PFC into the working folder backups area.

## Tuning

The `Tuning` tab is editable and becomes available after:

- Opening a `.dat` map file
- Loading a saved session
- Reading maps from the PFC

Editable maps:

- Injector Correction
- Base Map
- Ignition
- VVTi
- Target AFR

Each map has:

- `+` and `-` buttons
- Right-click editing actions
- `Save Map` or `Write Map to PFC`
- `Read [map] from PFC`

The Injector Correction and Base Map increment buttons adjust selected cells by `0.001`.

Right-click actions include:

- Add to selected cells
- Copy
- Paste
- Select all
- Interpolate

Interpolation works across selected rows and columns.

## Target AFR

The `Target AFR` map starts blank unless populated.

Options:

- Populate from Injector Correction
- Paste AFR Grid
- Clear AFR

Logging and AutoTuning are disabled until the AFR target map has been populated.

## AutoTuning And Logging

The `AutoTuning & Logging` tab contains:

- Autotuning Options
- Live Monitors
- Logged Data

The `Logged Data` view selector contains:

- Samples
- Logged AFR
- Logged Knock
- AFR Difference
- Base Map Changes

Logging tables use the loaded map's RPM and load axes.

### Logged AFR Views

Available views:

- True Logged AFR
- AFR Difference
- Base Map Changes

`Copy Changes to Working Base Map` copies calculated base-map changes into the editable Base Map in `Tuning`.

### Autotuning Checks

Available checks include:

- Minimum water temperature
- Minimum throttle position
- Minimum speed
- Minimum injector duty

Start Logging and Start AutoTuning remain disabled until the required checks are met.

### Ignition Autotuning

Ignition autotuning options include:

- Enable Ignition Autotuning when AutoTuning is active
- Enable Ignition Advance
- Low knock threshold
- Medium knock threshold
- High knock threshold

Planned behavior:

- High knock retards the current load cell by 2 degrees.
- Medium knock retards by 1 degree.
- No knock can advance timing by 1 degree when ignition advance is enabled.
- Low knock threshold is used as the boundary for holding timing steady.

## Online vs Offline

The app is offline until maps are read from the PFC through the selected serial port.

When offline:

- `PFC Maps` remains disabled.
- Tuning can be done from a loaded map/session.
- Map actions save to file instead of writing to the PFC.

When online:

- `PFC Maps` shows data read from the PFC.
- Map actions write to the PFC and then reread.
- RPM, AFR, and speed display areas are intended for live data.

## App Settings Cache

App preferences are stored at:

```text
%APPDATA%\PowerFCTuner\settings.json
```

This file stores:

- Working folder
- Selected serial port
- Baud/parity settings
- Recent files

Deleting this file resets those preferences.
