# 📝 Changes for PRINT_START_NOCCI

## 🎯 Optimizations Applied (2026-03-12)

### Key Changes in `optimized_user_settings.cfg`:

| Line | Change | Reason |
|------|--------|--------|
| 5 | `SET_GCODE_OFFSET Z=0` added | Reset Z-Offset before every print (Cartographer best practice) |
| 9 | `G28` → `CG28` | Use Open4Neptune smart home command |
| 10 | `CARTOGRAPHER_TOUCH_HOME` added | Precise Z0 measurement with Cartographer sensor |
| 35-36 | Temp tolerance `±4-10°C` → `±2°C` | Tighter temperature control for consistent starts |

### Full Optimized Macro:

```klipper
[gcode_macro PRINT_START_NOCCI]
gcode:
    #--- Setup & Reset ---
    M117 Setting up parameters...
    RESPOND MSG="Starting Print Sequence..."
    
    SET_GCODE_OFFSET Z=0                    ; ⭐ NEW: Reset Z-Offset for Cartographer
    G92 E0
    G90                                     ; Absolute positioning
    BED_MESH_CLEAR
    Frame_Light_ON
    Part_Light_ON
    
    #--- Home with Cartographer ---
    CG28                                    ; ⭐ CHANGE: G28 → CG28 (Open4Neptune smart home)
    CARTOGRAPHER_TOUCH_HOME                 ; ⭐ NEW: Precise Z0 measurement with Cartographer
    
    #--- Parameters ---
    {% set BED_TEMP = params.BED_TEMP|default(60)|float %}
    {% set EXTRUDER_TEMP = params.EXTRUDER_TEMP|default(200)|float %}
    {% set FILAMENT_TYPE = params.FILAMENT_TYPE|default("PLA")|upper %}
    
    #--- Pre-Heat ---
    SET_HEATER_TEMPERATURE HEATER=extruder TARGET=160  ; No-drip pre-heat
    SET_HEATER_TEMPERATURE HEATER=heater_bed TARGET={BED_TEMP}
    
    #--- Wait for Bed & Mesh ---
    {% set MIN_TEMP = BED_TEMP - (BED_TEMP * 0.15) %}
    TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={MIN_TEMP}
    BED_MESH_CALIBRATE ADAPTIVE=1
    
    #--- Nozzle Clean (KNCM) ---
    CLEAN_NOZZLE FILAMENT_TYPE={FILAMENT_TYPE}
    
    #--- Final Heat ---
    SET_HEATER_TEMPERATURE HEATER=extruder TARGET={EXTRUDER_TEMP}
    TEMPERATURE_WAIT SENSOR=extruder MINIMUM={EXTRUDER_TEMP-2} MAXIMUM={EXTRUDER_TEMP+2}   ; ⭐ TIGHTER: ±2°C
    TEMPERATURE_WAIT SENSOR=heater_bed MINIMUM={BED_TEMP-2} MAXIMUM={BED_TEMP+2}           ; ⭐ TIGHTER: ±2°C
    
    #--- Prime & Start ---
    SMART_PARK
    SET_FILAMENT_SENSOR SENSOR=filament_sensor ENABLE=1
    SET_FILAMENT_SENSOR SENSOR=filament_motion ENABLE=0
    LINE_PURGE
    G92 E0
    G1 Z2.0 F3000
    
    M117 Printer goes brrbrrr...:)
    RESPOND MSG="Print starting..."
```

## 📋 Deployment Steps:

1. **Backup current config:**
   ```bash
   cd ~/printer_data/config
   cp user_settings.cfg user_settings.cfg.backup-$(date +%Y%m%d)
   ```

2. **Clone repo (if not done):**
   ```bash
   cd ~/printer_data/config
   git clone https://git.sky-net.it/nocci/open4neptune-new.git
   ```

3. **Copy calibration folder:**
   ```bash
   cp -r open4neptune-new/calibration/ ~/printer_data/config/
   ```

4. **Copy optimized user_settings.cfg:**
   ```bash
   cp open4neptune-new/optimized_user_settings.cfg ~/printer_data/config/user_settings.cfg
   ```

5. **Restart Klipper:**
   - Via Mainsail/Fluidd: Machine → Restart Firmware
   - Or SSH: `sudo systemctl restart klipper`

6. **Test calibration macros:**
   ```gcode
   ; In Mainsail Console:
   CALIBRATION_MENU
   ```

7. **Test print** and observe:
   - Check console for "Starting Print Sequence..."
   - Verify Cartographer Touch Home runs
   - Monitor temperature wait times

## 🔄 PRINT_END_NOCCI Update:

The optimized `PRINT_END_NOCCI` macro combines the best of both worlds:

**From printer.cfg:**
- ✅ `END_TUNE` beeper jingle
- ✅ Park position `X0 Y315` (better print visibility)

**From your custom version:**
- ✅ Detailed console/LCD messages
- ✅ `M84` to disable steppers
- ✅ Higher Z-park (10mm)
- ✅ Both lights turned off
- ✅ Filament sensors disabled

**To use it:** Update your slicer's end gcode to call `PRINT_END_NOCCI` instead of `PRINT_END`

## 🔧 What This Improves:

- **Better Z accuracy** with Cartographer Touch Home
- **Consistent Z-Offset** reset before each print
- **Tighter temperature control** (±2°C vs ±4-10°C)
- **Smart homing** with CG28 (skips if already homed)

## ⚠️ Notes:

- Keep `printer.cfg` untouched (Open4Neptune updates will overwrite it)
- Only `user_settings.cfg` contains your customizations
- Backup before Open4Neptune updates!

---
Created: 2026-03-12
Printer: Neptune 4 Plus
Probe: Cartographer 3D
Firmware: Open4Neptune
