From 470014eaee786cf8740c61d331336769dbfb8d72 Mon Sep 17 00:00:00 2001 From: thkummi <36160753+thkummi@users.noreply.github.com> Date: Thu, 19 Aug 2021 15:33:16 +0200 Subject: [PATCH] Add files via upload --- Makefile | 9 ++++++--- ctenna.cbp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++ groundplane.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ groundplane.h | 21 ++++++++++++++++++++ main.c | 10 +++++++--- 5 files changed, 138 insertions(+), 6 deletions(-) create mode 100644 ctenna.cbp create mode 100644 groundplane.c create mode 100644 groundplane.h diff --git a/Makefile b/Makefile index 78d0bb4..a7ac055 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -ctenna: main.o hb9cv.o jpole.o - gcc -o ctenna main.o hb9cv.o jpole.o +ctenna: main.o hb9cv.o jpole.o groundplane.c + gcc -o ctenna main.o hb9cv.o jpole.o groundplane.c main.o: main.c gcc -c main.c @@ -8,4 +8,7 @@ hb9cv.o: hb9cv.c gcc -c hb9cv.c jpole.o: jpole.c - gcc -c jpole.c + gcc -c jpole.c + +groundplane.o: groundplane.c + gcc -c groundplane.c diff --git a/ctenna.cbp b/ctenna.cbp new file mode 100644 index 0000000..561c4f8 --- /dev/null +++ b/ctenna.cbp @@ -0,0 +1,53 @@ + + + + + + diff --git a/groundplane.c b/groundplane.c new file mode 100644 index 0000000..e49559d --- /dev/null +++ b/groundplane.c @@ -0,0 +1,51 @@ +/* +Lambda/4 Groundplane Antanna Calculator +Copyright (C) 2021 Thomas Kummer +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include +#include "groundplane.h" + +void gp_calc(float *f, float *unit_factor, float *lambda, float *l1, float *l2){ + *lambda = ( 29971000 / *f ) / 100; + *l1 = (0.96 * *lambda * 0.25) * *unit_factor; + *l2 = (0.96 * *lambda * 0.28) * *unit_factor; +} + +void gp_print(float *f, float *unit_factor, float *lambda, float *l1, float *l2, int *unit_index){ + printf(" Calculated for %f mHz\n", *f); + printf("\n"); + printf(" Vertical Radiator %f ", *l1); switch(*unit_index){ case 1: printf("mm\n"); break; case 2: printf("inch\n"); break; }; + printf(" Radials %f ", *l2); switch(*unit_index){ case 1: printf("mm\n"); break; case 2: printf("inch\n"); break; }; + printf("\n"); + printf("\n"); + printf(" O\n"); + printf(" I\n"); + printf(" I\n"); + printf(" Radiator I\n"); + printf(" I\n"); + printf(" I\n"); + printf(" I\n"); + printf(" I\n"); + printf(" ___|___ \n"); + printf(" /' | '\\ \n"); + printf(" \\.__|__./ \n"); + printf(" /| 50 |\\ \n"); + printf(" / | Ohm | \\ \n"); + printf(" Radial / ~~~~~~~~~ \\ \n"); + printf(" / \\ \n"); + printf(" / \\ \n"); + printf("\n"); + printf(" 3 - 6 radials are usual \n"); + printf("\n"); +} diff --git a/groundplane.h b/groundplane.h new file mode 100644 index 0000000..a06afd0 --- /dev/null +++ b/groundplane.h @@ -0,0 +1,21 @@ +/* +Copyright (C) 2021 Thomas Kummer +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#ifndef GROUNDPLANE_H_ +#define GROUNDPLANE_H_ + +void gp_calc(); +void gp_print(); + +#endif // GROUNDPLANE_H_ diff --git a/main.c b/main.c index 98c1d01..b876c12 100644 --- a/main.c +++ b/main.c @@ -15,11 +15,12 @@ along with this program. If not, see . #include #include "hb9cv.h" -#include "jpole.h" +#include "jpole.h" +#include "groundplane.h" //#include void clear_scr(void){ - printf("\033[H"); //brings cursor home + //printf("\033[H"); //brings cursor home printf("\x1b[2J"); //clears screen } @@ -105,7 +106,10 @@ int main(){ jpole_calc(&f, &unit_factor,&lambda, &l1, &l2, &l3, &l4, &raddiam); jpole_print(&f ,&unit_factor, &lambda, &l1, &l2, &l3, &l4, &raddiam, &unit_index); break; - case 4: printf("Not yet"); break; + case 4: clear_scr(); + gp_calc(&f, &unit_factor,&lambda, &l1, &l2); + gp_print(&f ,&unit_factor, &lambda, &l1, &l2, &unit_index); + break; case 5: clear_scr(); hb9cv_calc(&f ,&unit_factor, &lambda, &l1, &l2, &l3, &l4, &l5, &bdiam, &raddiam); hb9cv_print(&f ,&unit_factor, &lambda, &l1, &l2, &l3, &l4, &l5, &bdiam, &raddiam, &unit_index);