Keypad Help

I have a system set up so that you can punch in a number, press ‘*’ to reset to 0, and press ‘#’ to lock it in. From locking it in, a sensor counts down to 0 when things pass through. Once locked in though, nothing can be changed, and to reuse it needs to be shut off then turned on. I need a way that when the counter gets to 0, you can just punch in numbers again instead of shutting it off and turning it on again.

//Transceiving
//Keypad and Sensor Code
#include <Keypad.h>

int pirPin = 10; //Sensor code
int counter = 0;//Sensor code
int laststate = HIGH; //Sensor code
int num = 0;

const byte ROWS = 4; //four rows
const byte COLS = 3; //three columns
char keys[ROWS][COLS] = {
  {'1','2','3'},
  {'4','5','6'},
  {'7','8','9'},
  {'*','0','#'}
};
//byte rowPins[ROWS] = {5, 4, 3, 2}; //connect to the row pinouts of the keypad
//byte colPins[COLS] = {8, 7, 6}; //connect to the column pinouts of the keypad
byte rowPins[ROWS] = {5, 6, 7, 8}; //connect to the row pinouts of the keypad
byte colPins[COLS] = {2, 3, 4}; //connect to the column pinouts of the keypad
Keypad kpd = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  Serial.begin(9600);
  pinMode(pirPin,INPUT_PULLUP); //Sensor code
}

void loop()
{
  int v1 = GetNumber();
  Serial.println(v1);
  while (v1 > 0 )
  {
  int state = digitalRead(pirPin);
  if (laststate == LOW && state == HIGH) // only count on a LOW-> HIGH transition
  {
     v1--;
     Serial.println(v1);
  }
  laststate = state;  // remember last state
}
}


int GetNumber()
{
   char key = kpd.getKey();
   while(key != '#')
   {
      switch (key)
      {            
         case '0': case '1': case '2': case '3': case '4':
         case '5': case '6': case '7': case '8': case '9':
            //Serial.println(key);
            num = num * 10 + (key - '0');
            Serial.println(num);
            break;

         case '*':
            num = 0;
            Serial.println(num);
            break;
      }

      key = kpd.getKey();
   }
   return num;
}
//Receiving
//Display Code
char buffer;
int meow;

#include <Keypad.h>
#include <DMD.h> // for DMD
#include <SPI.h> // SPI.h must be included as DMD is written by SPI (the IDE complains otherwise)
#include <TimerOne.h> 
#include "SystemFont5x7.h"
#include "Arial_black_16.h"
#define DISPLAYS_ACROSS 1 // change to 2 for two screens, etc. 
#define DISPLAYS_DOWN 1
DMD dmd(DISPLAYS_ACROSS, DISPLAYS_DOWN);

void ScanDMD() // necessary interrupt handler for refresh scanning of DMD
{ 
  dmd.scanDisplayBySPI();
}

void setup() {
  Timer1.initialize( 5000 );           //period in microseconds to call ScanDMD. Anything longer than 5000 (5ms) and you can see flicker.
   Timer1.attachInterrupt( ScanDMD );   //attach the Timer1 interrupt to ScanDMD which goes to dmd.scanDisplayBySPI()  
   dmd.clearScreen( true );
Serial.begin(9600);

}

void loop() {
if(Serial.available()){
  char buffer[Serial.available()];
  Serial.readBytesUntil('n',buffer,Serial.available());
  meow = atof(buffer);
  dmd.clearScreen( true);
  Serial.println(meow);
  
  String counterAsString = String(meow);
  char stringBuffer[6];
  counterAsString.toCharArray(stringBuffer, 6);
  dmd.selectFont( Arial_Black_16 );
  dmd.drawString(3,1,stringBuffer, strlen(stringBuffer), GRAPHICS_NORMAL);
}
delay(100);
  
}

You need a condition that sets laststate back to LOW. Add this, once v1 equals "==" 0, laststate = LOW.

if (laststate == LOW && state == HIGH) // only count on a LOW-> HIGH transition
{
v1--;
Serial.println(v1);
}
laststate = state; // remember last state