Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[![CI](https://github.com/deftio/fr_math/actions/workflows/ci.yml/badge.svg)](https://github.com/deftio/fr_math/actions/workflows/ci.yml)
[![Coverage](https://img.shields.io/badge/coverage-99%25-brightgreen.svg)](#building-and-testing)
[![Docs](https://img.shields.io/badge/docs-online-blue.svg)](https://deftio.github.io/fr_math/)
[![Version](https://img.shields.io/badge/version-2.0.4-blue.svg)](release_notes.md)
[![Version](https://img.shields.io/badge/version-2.0.5-blue.svg)](release_notes.md)

# FR_Math: A C Language Fixed-Point Math Library for Embedded Systems

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.4
2.0.5
7 changes: 7 additions & 0 deletions docs/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ Release highlights. For the full per-symbol change log, see
[release_notes.md](https://github.com/deftio/fr_math/blob/master/release_notes.md)
in the repo.

## v2.0.5 — 2026

Release pipeline fixes. Fixed squash-merge divergence handling and
on-master push/CI sequencing in `tools/make_release.sh`.

---

## v2.0.4 — 2026

CI fix release. Fixed `release.yml` coverage step, release pipeline
Expand Down
2 changes: 1 addition & 1 deletion idf_component.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: "2.0.4"
version: "2.0.5"
description: "Compact fixed-point math library for embedded systems. Integer-only with caller-selectable radix. Trig, log/exp, sqrt, hypot, wave generators, ADSR, and 2D transforms. Zero dependencies."
url: "https://github.com/deftio/fr_math"
repository: "https://github.com/deftio/fr_math.git"
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "FR_Math",
"version": "2.0.4",
"version": "2.0.5",
"description": "Compact fixed-point math library for embedded systems. Integer-only with caller-selectable radix. Trig, log/exp, sqrt, hypot, wave generators, ADSR, and 2D transforms in 4KB of flash. Zero dependencies.",
"keywords": [
"fixed-point",
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=FR_Math
version=2.0.4
version=2.0.5
author=M. A. Chatterjee <deftio@deftio.com>
maintainer=M. A. Chatterjee <deftio@deftio.com>
sentence=Compact fixed-point math library for embedded systems. 4KB flash, zero dependencies, any radix.
Expand Down
2 changes: 1 addition & 1 deletion llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ or libraries. Pure C99, zero dependencies beyond `<stdint.h>`.
- Repository: https://github.com/deftio/fr_math
- Documentation: https://deftio.github.io/fr_math/
- License: BSD-2-Clause
- Version: 2.0.4
- Version: 2.0.5

## Key concept: radix parameter

Expand Down
2 changes: 1 addition & 1 deletion pages/assets/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
════════════════════════════════════════════════════════════════════ */

(function () {
var FR_VERSION = 'v2.0.4';
var FR_VERSION = 'v2.0.5';

// Detect whether we're a top-level page or inside guide/.
// Works for both file:// and http(s):// because we look for the
Expand Down
7 changes: 7 additions & 0 deletions pages/releases.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ <h1>Releases</h1>
<a href="https://github.com/deftio/fr_math/blob/master/release_notes.md">release_notes.md</a>
in the repo.</p>

<h2>v2.0.5 &mdash; 2026</h2>

<p>Release pipeline fixes. Fixed squash-merge divergence handling and
on-master push/CI sequencing in <code>tools/make_release.sh</code>.</p>

<hr>

<h2>v2.0.4 &mdash; 2026</h2>

<p>CI fix release. Fixed <code>release.yml</code> coverage step, release pipeline
Expand Down
21 changes: 16 additions & 5 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
# FR_Math Release Notes

## Version 2.0.5 (2026)

Release pipeline fixes. No functional changes to the math library.

- Fixed `tools/make_release.sh` failing after squash-merge: local master
diverges from origin (squash creates a new commit), so `git pull
--ff-only` fails. Now detects divergence and resets to origin/master.
- Fixed on-master release path: script now pushes master to origin and
waits for CI before tagging (previously skipped both, causing tags to
point at commits not yet on the remote).
- Release pipeline auto-commits pipeline-generated changes (badge
updates, version sync) instead of failing on a dirty working tree.
Unexpected dirty files still block the release.

## Version 2.0.4 (2026)

CI fix release. No functional changes to the math library.

- Fixed `release.yml` coverage step failing due to stale gcov invocation
- Release pipeline (`tools/make_release.sh`) now auto-commits
pipeline-generated changes (badge updates, version sync) instead of
failing on a dirty working tree
- Removed conflicting auto-release job from `ci.yml` (replaced by
tag-triggered `release.yml`)
- Documentation updated: `release_management.md`, `docs/building.md`,
and `pages/guide/building.html` now accurately describe the 17-step
guided release pipeline
and `pages/guide/building.html` now accurately describe the guided
release pipeline

---

Expand Down
4 changes: 2 additions & 2 deletions src/FR_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
#ifndef __FR_Math_h__
#define __FR_Math_h__

#define FR_MATH_VERSION "2.0.4"
#define FR_MATH_VERSION_HEX 0x020004 /* major << 16 | minor << 8 | patch */
#define FR_MATH_VERSION "2.0.5"
#define FR_MATH_VERSION_HEX 0x020005 /* major << 16 | minor << 8 | patch */

#ifdef __cplusplus
extern "C"
Expand Down
2 changes: 1 addition & 1 deletion src/FR_math_2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
* @copy Copyright (C) <2001-2026> <M. A. Chatterjee>
* @author M A Chatterjee <deftio [at] deftio [dot] com>
* @version 2.0.4 M. A. Chatterjee, cleaned up naming
* @version 2.0.5 M. A. Chatterjee, cleaned up naming
*
* This file contains integer math settable fixed point radix math routines for
* use on systems in which floating point is not desired or unavailable.
Expand Down
2 changes: 1 addition & 1 deletion src/FR_math_2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* @copy Copyright (C) <2001-2026> <M. A. Chatterjee>
* @author M A Chatterjee <deftio [at] deftio [dot] com>
* @version 2.0.4 M. A. Chatterjee, cleaned up naming
* @version 2.0.5 M. A. Chatterjee, cleaned up naming
*
* This file contains integer math settable fixed point radix math routines for
* use on systems in which floating point is not desired or unavailable.
Expand Down
158 changes: 158 additions & 0 deletions tools/check_published_versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
#!/usr/bin/env bash
#
# check_published_versions.sh — show the published version of FR_Math
# on every distribution channel alongside the local source version.
#
# Usage:
# bash tools/check_published_versions.sh
#
# Channels checked:
# - Local source (FR_MATH_VERSION_HEX in src/FR_math.h)
# - GitHub Releases (gh CLI or GitHub API)
# - Arduino Library Manager (arduino-cli or library index API)
# - PlatformIO Registry (pio CLI or registry API)
# - ESP-IDF Component Registry (API only; compote has no query command)

set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"

# Colors (disabled if stdout is not a TTY).
if [[ -t 1 ]]; then
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
CYAN='\033[0;36m'
NC='\033[0m'
else
GREEN=''
YELLOW=''
RED=''
CYAN=''
NC=''
fi

# -----------------------------------------------------------------------
# Local source version
# -----------------------------------------------------------------------
LOCAL_VER="unknown"
H_FILE="${PROJECT_ROOT}/src/FR_math.h"
if [[ -f "${H_FILE}" ]]; then
RAW_HEX=$(grep '#define FR_MATH_VERSION_HEX' "${H_FILE}" | awk '{print $3}' | tr -d '\r')
if [[ -n "${RAW_HEX}" ]]; then
HEX_NUM=$((RAW_HEX))
V_MAJ=$(( (HEX_NUM >> 16) & 0xff ))
V_MIN=$(( (HEX_NUM >> 8) & 0xff ))
V_PAT=$(( HEX_NUM & 0xff ))
LOCAL_VER="${V_MAJ}.${V_MIN}.${V_PAT}"
fi
fi

# -----------------------------------------------------------------------
# GitHub Releases
# -----------------------------------------------------------------------
get_github_version() {
if command -v gh &>/dev/null; then
gh api repos/deftio/fr_math/releases/latest --jq '.tag_name' 2>/dev/null | sed 's/^v//' || echo "not found"
elif command -v curl &>/dev/null; then
curl -sf https://api.github.com/repos/deftio/fr_math/releases/latest \
| python3 -c "import sys,json; print(json.load(sys.stdin).get('tag_name','not found').lstrip('v'))" 2>/dev/null || echo "not found"
else
echo "no tool"
fi
}

# -----------------------------------------------------------------------
# Arduino Library Manager
# -----------------------------------------------------------------------
get_arduino_version() {
if command -v arduino-cli &>/dev/null; then
local result
result=$(arduino-cli lib search "FR_Math" 2>/dev/null || true)
if echo "$result" | grep -q "FR_Math"; then
echo "$result" | grep -A1 "^Name:" | grep "Version:" | awk '{print $2}' || echo "not found"
else
echo "not registered"
fi
elif command -v curl &>/dev/null; then
local ver
ver=$(curl -sf https://downloads.arduino.cc/libraries/library_index.json.gz 2>/dev/null \
| gunzip 2>/dev/null \
| python3 -c "
import sys, json
data = json.load(sys.stdin)
libs = [l for l in data['libraries'] if l['name'] == 'FR_Math']
if libs:
latest = max(libs, key=lambda x: x['version'])
print(latest['version'])
else:
print('not registered')
" 2>/dev/null || echo "error")
echo "$ver"
else
echo "no tool"
fi
}

# -----------------------------------------------------------------------
# PlatformIO Registry
# -----------------------------------------------------------------------
get_platformio_version() {
if command -v pio &>/dev/null; then
pio pkg show deftio/FR_Math 2>/dev/null \
| grep -i 'library' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1 || echo "not found"
elif command -v curl &>/dev/null; then
curl -sf "https://registry.platformio.org/api/packages/deftio/library/FR_Math" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['version']['name'])" 2>/dev/null || echo "not found"
else
echo "no tool"
fi
}

# -----------------------------------------------------------------------
# ESP-IDF Component Registry
# -----------------------------------------------------------------------
get_espressif_version() {
if command -v curl &>/dev/null; then
curl -sf "https://components.espressif.com/api/components/deftio/fr_math" \
| python3 -c "import sys,json; print(json.load(sys.stdin)['versions'][0]['version'])" 2>/dev/null || echo "not found"
else
echo "no tool"
fi
}

# -----------------------------------------------------------------------
# Print results
# -----------------------------------------------------------------------
echo ""
echo -e "${CYAN}FR_Math Published Versions${NC}"
echo "=========================="
echo ""

BRANCH=$(git -C "${PROJECT_ROOT}" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
printf " %-22s %s\n" "Branch:" "${BRANCH}"
printf " %-22s %s\n" "Local version:" "${LOCAL_VER}"
echo ""

GITHUB_VER=$(get_github_version)
ARDUINO_VER=$(get_arduino_version)
PIO_VER=$(get_platformio_version)
ESP_VER=$(get_espressif_version)

color_version() {
local ver="$1"
if [[ "$ver" == "$LOCAL_VER" ]]; then
echo -e "${GREEN}${ver}${NC}"
elif [[ "$ver" == "not found" || "$ver" == "not registered" || "$ver" == "no tool" || "$ver" == "error" ]]; then
echo -e "${YELLOW}${ver}${NC}"
else
echo -e "${RED}${ver}${NC} (drift)"
fi
}

printf " %-22s %b\n" "GitHub Releases:" "$(color_version "$GITHUB_VER")"
printf " %-22s %b\n" "Arduino Library:" "$(color_version "$ARDUINO_VER")"
printf " %-22s %b\n" "PlatformIO Registry:" "$(color_version "$PIO_VER")"
printf " %-22s %b\n" "ESP-IDF Components:" "$(color_version "$ESP_VER")"
echo ""
34 changes: 26 additions & 8 deletions tools/make_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -364,15 +364,24 @@ do_push_branch() {
fi
fi

# Check if we're ahead of origin (works for both master and feature branches).
local ahead
ahead=$(git rev-list --count "origin/$BRANCH..HEAD" 2>/dev/null || echo "0")
if [ "$ahead" -eq 0 ]; then
pass "$BRANCH is up to date with origin."
return 0
# Check if remote branch exists and whether we're ahead.
local remote_exists=true
if ! git rev-parse --verify "origin/$BRANCH" &>/dev/null; then
remote_exists=false
fi

if $remote_exists; then
local ahead
ahead=$(git rev-list --count "origin/$BRANCH..HEAD" 2>/dev/null || echo "0")
if [ "$ahead" -eq 0 ]; then
pass "$BRANCH is up to date with origin."
return 0
fi
echo " $ahead commit(s) ahead of origin/$BRANCH."
else
echo " Remote branch origin/$BRANCH does not exist yet."
fi

echo " $ahead commit(s) ahead of origin/$BRANCH."
confirm "Push $BRANCH to origin?"
run_cmd git push -u origin "$BRANCH"
pass "Pushed."
Expand Down Expand Up @@ -608,7 +617,16 @@ do_switch_master() {
fi

run_cmd git checkout master
run_cmd git pull --ff-only origin master
run_cmd git fetch origin master
# After a squash-merge, local master and origin/master have diverged
# (the squash commit is a new commit). Reset to origin/master which
# has the authoritative squash-merged content.
if ! git merge-base --is-ancestor origin/master HEAD 2>/dev/null; then
echo " Local master diverged from origin (expected after squash-merge)."
run_cmd git reset --hard origin/master
else
run_cmd git pull --ff-only origin master
fi
BRANCH="master"
ON_MASTER=true
pass "On master at $(git rev-parse --short HEAD)."
Expand Down
Loading